cli: add and use app:lint + include default eslint config in cli

This commit is contained in:
Patrik Oldsberg
2020-03-18 15:09:48 +01:00
parent ee34b77b35
commit a711dc21b2
7 changed files with 82 additions and 63 deletions
+27
View File
@@ -0,0 +1,27 @@
/*
* Copyright 2020 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Command } from 'commander';
import { run } from '../../helpers/run';
export default async (cmd: Command) => {
const args = ['lint'];
if (cmd.fix) {
args.push('--fix');
}
await run('web-scripts', args);
};
+7
View File
@@ -19,6 +19,7 @@ import chalk from 'chalk';
import fs from 'fs';
import createPluginCommand from './commands/createPlugin';
import watch from './commands/watch-deps';
import appLint from './commands/app/lint';
import pluginBuild from './commands/plugin/build';
import pluginLint from './commands/plugin/lint';
import pluginServe from './commands/plugin/serve';
@@ -30,6 +31,12 @@ const main = (argv: string[]) => {
program.name('backstage-cli').version(packageJson.version ?? '0.0.0');
program
.command('app:lint')
.option('--fix', 'Attempt to automatically fix violations')
.description('Lint an app')
.action(actionHandler(appLint));
program
.command('create-plugin')
.description('Creates a new plugin in the current repository')