Skip to content

Commit

Permalink
feat(eslint): pass cli arguments to linter (#1258)
Browse files Browse the repository at this point in the history
close #1255
  • Loading branch information
dhensche authored and yyx990803 committed May 18, 2018
1 parent ab877a2 commit 9ac2642
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion packages/@vue/cli-plugin-eslint/lint.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
const renamedArrayArgs = {
ext: 'extensions',
env: 'envs',
global: 'globals',
rulesdir: 'rulePaths',
plugin: 'plugins',
'ignore-pattern': 'ignorePattern'
}

const renamedArgs = {
'inline-config': 'allowInlineConfig',
rule: 'rules',
eslintrc: 'useEslintrc',
c: 'configFile',
config: 'configFile'
}

module.exports = function lint (args = {}, api) {
const path = require('path')
const chalk = require('chalk')
Expand Down Expand Up @@ -59,7 +76,11 @@ module.exports = function lint (args = {}, api) {
function normalizeConfig (args) {
const config = {}
for (const key in args) {
if (key !== '_') {
if (renamedArrayArgs[key]) {
config[renamedArrayArgs[key]] = args[key].split(',')
} else if (renamedArgs[key]) {
config[renamedArgs[key]] = args[key]
} else if (key !== '_') {
config[camelize(key)] = args[key]
}
}
Expand Down

0 comments on commit 9ac2642

Please sign in to comment.