This moves our eslint config in .eslint.js, which allows us to use conditionals in the config file itself, significantly simpliying rule creation. For small-scale differences, this seems to be the simplest solution.
This commit is contained in:
47
.eslintrc.js
Normal file
47
.eslintrc.js
Normal file
@@ -0,0 +1,47 @@
|
||||
module.exports = {
|
||||
"root": true,
|
||||
"extends": "eslint:recommended",
|
||||
"globals": {
|
||||
"wp": true
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true,
|
||||
"amd": true,
|
||||
"browser": true,
|
||||
"jquery": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"globalReturn": true,
|
||||
"generators": false,
|
||||
"objectLiteralDuplicateProperties": false,
|
||||
"experimentalObjectRestSpread": true
|
||||
},
|
||||
"ecmaVersion": 2017,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"import"
|
||||
],
|
||||
"settings": {
|
||||
"import/core-modules": [],
|
||||
"import/ignore": [
|
||||
"node_modules",
|
||||
"\\.(coffee|scss|css|less|hbs|svg|json)$"
|
||||
]
|
||||
},
|
||||
"rules": {
|
||||
"no-console": process.env.NODE_ENV === 'production' ? 2 : 0,
|
||||
"comma-dangle": [
|
||||
"error",
|
||||
{
|
||||
"arrays": "always-multiline",
|
||||
"objects": "always-multiline",
|
||||
"imports": "always-multiline",
|
||||
"exports": "always-multiline",
|
||||
"functions": "ignore"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": [
|
||||
"./package.json"
|
||||
],
|
||||
"rules": {
|
||||
"no-console": ["error"]
|
||||
}
|
||||
}
|
||||
47
package.json
47
package.json
@@ -22,53 +22,6 @@
|
||||
"android 4",
|
||||
"opera 12"
|
||||
],
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": "eslint:recommended",
|
||||
"globals": {
|
||||
"wp": true
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es6": true,
|
||||
"amd": true,
|
||||
"browser": true,
|
||||
"jquery": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"globalReturn": true,
|
||||
"generators": false,
|
||||
"objectLiteralDuplicateProperties": false,
|
||||
"experimentalObjectRestSpread": true
|
||||
},
|
||||
"ecmaVersion": 2017,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"import"
|
||||
],
|
||||
"settings": {
|
||||
"import/core-modules": [],
|
||||
"import/ignore": [
|
||||
"node_modules",
|
||||
"\\.(coffee|scss|css|less|hbs|svg|json)$"
|
||||
]
|
||||
},
|
||||
"rules": {
|
||||
"no-console": ["off"],
|
||||
"comma-dangle": [
|
||||
"error",
|
||||
{
|
||||
"arrays": "always-multiline",
|
||||
"objects": "always-multiline",
|
||||
"imports": "always-multiline",
|
||||
"exports": "always-multiline",
|
||||
"functions": "ignore"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"stylelint": {
|
||||
"extends": "stylelint-config-standard",
|
||||
"rules": {
|
||||
|
||||
@@ -41,10 +41,7 @@ let webpackConfig = {
|
||||
enforce: 'pre',
|
||||
test: /\.js$/,
|
||||
include: config.paths.assets,
|
||||
loader: 'eslint-loader',
|
||||
options: {
|
||||
configFile: config.env.production ? config.paths.eslintProd : null,
|
||||
},
|
||||
use: 'eslint',
|
||||
},
|
||||
{
|
||||
enforce: 'pre',
|
||||
|
||||
Reference in New Issue
Block a user