UNPKG

@stordata/eslint-config

Version:

Shareable ESLint configuration for Stordata projects

93 lines (91 loc) 2.75 kB
'use strict'; module.exports = { extends: [ 'airbnb-base', 'plugin:n/recommended', 'plugin:json/recommended' ], env: { node: true, mocha: true }, plugins: [ 'n', 'import', 'json', 'no-only-tests' ], rules: { strict: ['error', 'safe'], indent: ['error', 2, { VariableDeclarator: { var: 2, let: 2, const: 3 }, SwitchCase: 1 }], 'one-var': ['error', 'consecutive'], 'comma-dangle': ['error', 'never'], 'consistent-return': ['off'], 'space-before-function-paren': ['error', 'never'], 'no-unused-vars': ['error', { argsIgnorePattern: 'next' }], 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], 'max-len': ['error', 150, { ignoreUrls: true, ignoreComments: false, ignoreRegExpLiterals: true, ignoreStrings: true, ignoreTemplateLiterals: true }], 'no-multiple-empty-lines': ['error', { max: 1 }], 'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }], 'global-require': ['off'], // TODO Remove and fix violations 'object-curly-newline': ['off'], 'func-names': 'off', 'padded-blocks': 'off', 'no-underscore-dangle': 'off', 'no-extra-parens': 'error', 'no-restricted-syntax': 'off', 'no-await-in-loop': 'off', 'no-use-before-define': 'off', 'newline-before-return': 'error', 'import/order': 'off', // TODO Remove and fix violations 'operator-linebreak': 'off', 'no-process-exit': 'off', 'no-param-reassign': ['error', { props: true, ignorePropertyModificationsFor: [ // Inherited from Airbnb style guide 'acc', // for reduce accumulators 'accumulator', // for reduce accumulators 'req', // for Express requests 'res', // for Express responses '$scope', // for Angular 1 scopes // Stordata overrides 'instance', // For sequelize instances (in hooks for instance) '$delegate' // For $provide.decorator() ] }], 'class-methods-use-this': ['off'] }, overrides: [ { files: [ '**/*.test.js', '**/*.spec.js', '**/*.spec.jsx', 'setupTests.js', 'setupTests.jsx', 'Gruntfile.js' ], rules: { 'no-only-tests/no-only-tests': 'error', 'import/no-extraneous-dependencies': ['off'], 'n/no-unpublished-require': ['off'], // https://github.com/mysticatea/eslint-plugin-node/issues/47 'n/no-unpublished-import': ['off'], // https://github.com/mysticatea/eslint-plugin-node/issues/47 'prefer-arrow-callback': 'off' // Mocha stores everything on this, arrow functions can't be used } } ] };