Skip to content

Commit 9ac2642

Browse files
dhenscheyyx990803
authored andcommitted
feat(eslint): pass cli arguments to linter (#1258)
close #1255
1 parent ab877a2 commit 9ac2642

File tree

1 file changed

+22
-1
lines changed
  • packages/@vue/cli-plugin-eslint

1 file changed

+22
-1
lines changed

packages/@vue/cli-plugin-eslint/lint.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
const renamedArrayArgs = {
2+
ext: 'extensions',
3+
env: 'envs',
4+
global: 'globals',
5+
rulesdir: 'rulePaths',
6+
plugin: 'plugins',
7+
'ignore-pattern': 'ignorePattern'
8+
}
9+
10+
const renamedArgs = {
11+
'inline-config': 'allowInlineConfig',
12+
rule: 'rules',
13+
eslintrc: 'useEslintrc',
14+
c: 'configFile',
15+
config: 'configFile'
16+
}
17+
118
module.exports = function lint (args = {}, api) {
219
const path = require('path')
320
const chalk = require('chalk')
@@ -59,7 +76,11 @@ module.exports = function lint (args = {}, api) {
5976
function normalizeConfig (args) {
6077
const config = {}
6178
for (const key in args) {
62-
if (key !== '_') {
79+
if (renamedArrayArgs[key]) {
80+
config[renamedArrayArgs[key]] = args[key].split(',')
81+
} else if (renamedArgs[key]) {
82+
config[renamedArgs[key]] = args[key]
83+
} else if (key !== '_') {
6384
config[camelize(key)] = args[key]
6485
}
6586
}

0 commit comments

Comments
 (0)