|
| 1 | +const js = require('@eslint/js'); |
| 2 | +const stylistic = require('@stylistic/eslint-plugin'); |
| 3 | +const globals = require('globals'); |
| 4 | + |
| 5 | +module.exports = [ |
| 6 | + js.configs.recommended, |
| 7 | + { |
| 8 | + plugins: { |
| 9 | + '@stylistic': stylistic |
| 10 | + }, |
| 11 | + languageOptions: { |
| 12 | + ecmaVersion: 2020, |
| 13 | + sourceType: 'commonjs', |
| 14 | + globals: { |
| 15 | + ...globals.node, |
| 16 | + ...globals.commonjs, |
| 17 | + ...globals.es2020, |
| 18 | + Atomics: 'readonly', |
| 19 | + SharedArrayBuffer: 'readonly' |
| 20 | + } |
| 21 | + }, |
| 22 | + rules: { |
| 23 | + // Stylistic rules (migrated from airbnb-base) |
| 24 | + '@stylistic/comma-dangle': ['error', 'never'], |
| 25 | + '@stylistic/indent': ['error', 2, { SwitchCase: 1 }], |
| 26 | + '@stylistic/semi': ['error', 'always'], |
| 27 | + '@stylistic/quotes': ['error', 'single', { avoidEscape: true }], |
| 28 | + '@stylistic/arrow-parens': ['error', 'always'], |
| 29 | + '@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }], |
| 30 | + '@stylistic/comma-spacing': ['error', { before: false, after: true }], |
| 31 | + '@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }], |
| 32 | + '@stylistic/keyword-spacing': ['error', { before: true, after: true }], |
| 33 | + '@stylistic/eol-last': ['error', 'always'], |
| 34 | + '@stylistic/no-trailing-spaces': 'error', |
| 35 | + '@stylistic/space-before-blocks': 'error', |
| 36 | + '@stylistic/space-infix-ops': 'error', |
| 37 | + '@stylistic/arrow-spacing': ['error', { before: true, after: true }], |
| 38 | + |
| 39 | + // JS rules (migrated from airbnb-base) |
| 40 | + 'no-console': 'off', |
| 41 | + 'no-var': 'error', |
| 42 | + 'prefer-const': 'error', |
| 43 | + 'prefer-arrow-callback': 'error', |
| 44 | + 'prefer-template': 'error', |
| 45 | + 'object-shorthand': ['error', 'always'], |
| 46 | + 'no-shadow': 'error', |
| 47 | + 'no-use-before-define': ['error', { functions: true, classes: true, variables: true }], |
| 48 | + 'camelcase': ['error', { properties: 'never' }], |
| 49 | + 'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }] |
| 50 | + } |
| 51 | + } |
| 52 | +]; |
0 commit comments