|
| 1 | +// keeping this as a commonJS file for now -- PyCharm goes crazy if we make it a .mjs file -- thinks |
| 2 | +// everything ending in js is then one. |
| 3 | +const globals = require('globals'); |
| 4 | +const { configs: airbnb } = require('eslint-config-airbnb-extended/legacy'); |
| 5 | +const eslint_parser = require('@typescript-eslint/parser'); |
| 6 | +const eslint_plugin = require('@typescript-eslint/eslint-plugin'); |
| 7 | + |
| 8 | +const no_unused_vars_config = [ |
| 9 | + 'warn', |
| 10 | + { |
| 11 | + args: 'none', |
| 12 | + caughtErrors: 'none', |
| 13 | + varsIgnorePattern: '^_.*|^i$|^j$|^unused|^junk|^counter', |
| 14 | + }, |
| 15 | +]; |
| 16 | + |
| 17 | + |
| 18 | +module.exports = [ |
| 19 | + ...airbnb.base.recommended, // this is the flat-eslint version of airbnb-base |
| 20 | + { |
| 21 | + ignores: ['releases/*', 'build/*', 'node_modules/*'], |
| 22 | + files: ['**/*.js', '**/*.ts'], // tsx would go here, etc. |
| 23 | + languageOptions: { |
| 24 | + ecmaVersion: 'latest', |
| 25 | + globals: { |
| 26 | + ...globals.browser, |
| 27 | + ...globals.jquery, |
| 28 | + ...globals.es2026, // this should be the latest in globals, not what we transpile to. |
| 29 | + }, |
| 30 | + }, |
| 31 | + rules: { |
| 32 | + 'array-bracket-spacing': ['off'], |
| 33 | + 'arrow-body-style': ['off'], |
| 34 | + 'arrow-parens': ['off'], |
| 35 | + 'brace-style': ['off'], |
| 36 | + 'camelcase': ['off'], |
| 37 | + 'class-methods-use-this': ['off'], |
| 38 | + 'comma-dangle': ['warn', { |
| 39 | + arrays: 'only-multiline', |
| 40 | + objects: 'always-multiline', |
| 41 | + imports: 'always-multiline', |
| 42 | + exports: 'always-multiline', |
| 43 | + functions: 'ignore', |
| 44 | + }], |
| 45 | + 'curly': ['warn', 'all'], |
| 46 | + 'dot-location': ['warn', 'property'], |
| 47 | + 'dot-notation': ['error'], |
| 48 | + 'function-paren-newline': ['warn', 'consistent'], |
| 49 | + 'indent': ['warn', 4, { |
| 50 | + ignoredNodes: ['TemplateLiteral *'], |
| 51 | + }], |
| 52 | + 'import/extensions': ['off'], |
| 53 | + 'import/prefer-default-export': ['off'], |
| 54 | + 'import/no-named-as-default': ['off'], |
| 55 | + 'import/no-named-as-default-member': ['off'], |
| 56 | + 'import/no-unresolved': ['off'], |
| 57 | + 'import/no-extraneous-dependencies': ['off'], |
| 58 | + 'linebreak-style': ['off'], |
| 59 | + 'lines-between-class-members': ['warn', 'always', { |
| 60 | + exceptAfterSingleLine: true, |
| 61 | + }], |
| 62 | + 'max-classes-per-file': ['off'], |
| 63 | + 'max-len': [ |
| 64 | + 'warn', { |
| 65 | + code: 120, |
| 66 | + ignoreUrls: true, |
| 67 | + ignoreTemplateLiterals: true, |
| 68 | + ignoreTrailingComments: true, |
| 69 | + }, |
| 70 | + ], |
| 71 | + 'new-cap': ['off'], |
| 72 | + 'no-case-declarations': ['error'], |
| 73 | + 'no-console': ['off'], |
| 74 | + 'no-continue': ['off'], |
| 75 | + 'no-confusing-arrow': ['off'], |
| 76 | + 'no-else-return': ['off'], |
| 77 | + 'no-floating-decimal': ['warn'], |
| 78 | + 'no-lonely-if': ['off'], |
| 79 | + 'no-mixed-operators': ['off'], |
| 80 | + 'no-multi-spaces': ['off'], |
| 81 | + 'no-multiple-empty-lines': ['warn', { max: 3 }], |
| 82 | + 'no-param-reassign': ['off'], |
| 83 | + 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], |
| 84 | + 'no-promise-executor-return': ['off'], |
| 85 | + 'no-restricted-syntax': [ |
| 86 | + 2, |
| 87 | + 'DebuggerStatement', |
| 88 | + 'LabeledStatement', |
| 89 | + 'WithStatement', |
| 90 | + ], |
| 91 | + 'no-return-assign': ['warn', 'except-parens'], |
| 92 | + 'no-shadow': ['off'], |
| 93 | + 'no-trailing-spaces': ['off'], |
| 94 | + 'no-use-before-define': ['off'], |
| 95 | + 'no-underscore-dangle': ['off'], |
| 96 | + 'no-unused-vars': no_unused_vars_config, |
| 97 | + 'no-useless-return': ['warn'], |
| 98 | + 'object-curly-spacing': ['off'], |
| 99 | + 'object-curly-newline': ['warn', { |
| 100 | + ObjectExpression: { multiline: true, minProperties: 5, consistent: true }, |
| 101 | + ObjectPattern: { multiline: true, minProperties: 5, consistent: true }, |
| 102 | + ImportDeclaration: { multiline: true, minProperties: 5, consistent: true }, |
| 103 | + ExportDeclaration: { multiline: true, minProperties: 5, consistent: true }, |
| 104 | + }], |
| 105 | + 'object-property-newline': ['off'], |
| 106 | + 'object-shorthand': ['off'], |
| 107 | + 'operator-linebreak': ['off'], |
| 108 | + 'padded-blocks': ['off'], |
| 109 | + 'prefer-const': [ |
| 110 | + 'warn', |
| 111 | + { |
| 112 | + 'destructuring': 'all', |
| 113 | + } |
| 114 | + ], |
| 115 | + 'prefer-destructuring': ['off'], |
| 116 | + 'prefer-object-spread': ['warn'], |
| 117 | + 'prefer-regex-literals': ['off'], |
| 118 | + 'prefer-template': ['off'], |
| 119 | + 'quote-props': ['off'], |
| 120 | + 'quotes': ['warn'], |
| 121 | + 'radix': ['off'], |
| 122 | + 'semi-style': ['warn'], |
| 123 | + 'space-infix-ops': ['off'], |
| 124 | + 'spaced-comment': ['off'], |
| 125 | + 'strict': ['error', 'global'], |
| 126 | + 'yoda': ['error', 'never', { exceptRange: true }], |
| 127 | + }, |
| 128 | + }, |
| 129 | + { |
| 130 | + // formerly "overrides" |
| 131 | + files: ['**/*.ts'], |
| 132 | + plugins: { |
| 133 | + '@typescript-eslint': eslint_plugin, |
| 134 | + }, |
| 135 | + languageOptions: { |
| 136 | + parser: eslint_parser, |
| 137 | + }, |
| 138 | + rules: { |
| 139 | + '@typescript-eslint/no-unused-vars': no_unused_vars_config, |
| 140 | + 'no-undef': 'off', |
| 141 | + 'no-unused-vars': 'off', |
| 142 | + }, |
| 143 | + }, |
| 144 | +]; |
0 commit comments