Last active
April 5, 2019 16:37
-
-
Save nunof07/a5a9d576cc84c11e96a219e2b3948f96 to your computer and use it in GitHub Desktop.
ESLint configuration for Sage theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
'root': true, | |
'extends': [ | |
'eslint:recommended', | |
'plugin:sonarjs/recommended', | |
'plugin:unicorn/recommended', | |
'es/2015/client', | |
], | |
'globals': { | |
'wp': true, | |
}, | |
'env': { | |
'node': true, | |
'es6': true, | |
'amd': true, | |
'browser': true, | |
'jquery': true, | |
}, | |
'parserOptions': { | |
'ecmaFeatures': { | |
'globalReturn': true, | |
'generators': true, | |
}, | |
'ecmaVersion': 2018, | |
'sourceType': 'module', | |
}, | |
'plugins': [ | |
'import', | |
'sonarjs', | |
'unicorn', | |
], | |
'settings': { | |
'import/core-modules': [], | |
'import/ignore': [ | |
'node_modules', | |
'\\.(coffee|scss|css|less|hbs|svg|json)$', | |
], | |
}, | |
'rules': { | |
'quotes': ['error', 'single'], | |
'comma-dangle': [ | |
'error', | |
{ | |
'arrays': 'always-multiline', | |
'objects': 'always-multiline', | |
'imports': 'always-multiline', | |
'exports': 'always-multiline', | |
'functions': 'ignore', | |
}, | |
], | |
'unicorn/filename-case': [ | |
'error', | |
{ | |
'case': 'camelCase', | |
}, | |
], | |
'linebreak-style': 0, | |
'id-length': [ 2, { | |
min: 2, | |
max: Number.infinity, | |
properties: 'always', | |
exceptions: [ '_', 'i', 'j', 'x', 'y', 'z', '$' ] | |
}], | |
'sort-imports': [ 2, { | |
ignoreCase: true, | |
ignoreMemberSort: false, | |
memberSyntaxSortOrder: [ 'none', 'single', 'multiple', 'all' ] | |
}], | |
'space-before-function-paren': ['error', { | |
'anonymous': 'always', | |
'named': 'never', | |
'asyncArrow': 'always', | |
}], | |
'dot-location': ['error', 'property'], | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install --save-dev eslint@5.16.0 eslint-config-es eslint-plugin-sonarjs eslint-plugin-unicorn |
When using with Sage, either fix the linting errors in the build scripts or exclude the build scripts from linting by updating in package.json
: "lint:scripts": "eslint resources/assets/scripts"
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First update eslint to the latest version and install the additional package.