Skip to content

Instantly share code, notes, and snippets.

@nunof07

nunof07/.eslintrc.js

Last active Apr 5, 2019
Embed
What would you like to do?
ESLint configuration for Sage theme
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'],
},
};
npm install --save-dev eslint@5.16.0 eslint-config-es eslint-plugin-sonarjs eslint-plugin-unicorn
@nunof07

This comment has been minimized.

Copy link
Owner Author

@nunof07 nunof07 commented Apr 5, 2019

First update eslint to the latest version and install the additional package.

@nunof07

This comment has been minimized.

Copy link
Owner Author

@nunof07 nunof07 commented Apr 5, 2019

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