|
@@ -1,58 +1,232 @@
|
|
|
import globals from 'globals';
|
|
|
-import standardConfig from './eslint-config-standard.js';
|
|
|
-import tseslint from 'typescript-eslint';
|
|
|
+import pluginN from 'eslint-plugin-n';
|
|
|
+import tsEslint from 'typescript-eslint';
|
|
|
+import stylistic from '@stylistic/eslint-plugin';
|
|
|
|
|
|
export default [
|
|
|
{
|
|
|
- ignores: ['**/lib', '**/*.min.js', '**/public']
|
|
|
+ ignores: ['**/lib', '**/*.min.js', '**/public'],
|
|
|
},
|
|
|
- standardConfig,
|
|
|
- ...tseslint.configs.recommended,
|
|
|
+ ...tsEslint.configs.recommended,
|
|
|
{
|
|
|
+ plugins: {
|
|
|
+ '@n': pluginN,
|
|
|
+ '@stylistic': stylistic,
|
|
|
+ },
|
|
|
+
|
|
|
languageOptions: {
|
|
|
+ ecmaVersion: 2024,
|
|
|
+ sourceType: 'module',
|
|
|
+
|
|
|
globals: {
|
|
|
+ ...globals.es2024,
|
|
|
...globals.node,
|
|
|
- ...globals.browser
|
|
|
- }
|
|
|
+ ...globals.browser,
|
|
|
+ document: 'readonly',
|
|
|
+ navigator: 'readonly',
|
|
|
+ window: 'readonly',
|
|
|
+ },
|
|
|
},
|
|
|
|
|
|
rules: {
|
|
|
- semi: ['error', 'always'],
|
|
|
+ 'accessor-pairs': ['error', { setWithoutGet: true, enforceForClassMembers: true }],
|
|
|
+ 'array-callback-return': ['error', {
|
|
|
+ allowImplicit: false,
|
|
|
+ checkForEach: false,
|
|
|
+ }],
|
|
|
+ 'constructor-super': 'error',
|
|
|
+ curly: ['error', 'multi-line'],
|
|
|
+ 'default-case-last': 'error',
|
|
|
+ 'dot-notation': ['error', { allowKeywords: true }],
|
|
|
+ eqeqeq: ['error', 'always', { null: 'ignore' }],
|
|
|
+ 'new-cap': ['error', { newIsCap: true, capIsNew: false, properties: true }],
|
|
|
+ 'no-array-constructor': 'error',
|
|
|
+ 'no-async-promise-executor': 'error',
|
|
|
+ 'no-caller': 'error',
|
|
|
+ 'no-case-declarations': 'error',
|
|
|
+ 'no-class-assign': 'error',
|
|
|
+ 'no-compare-neg-zero': 'error',
|
|
|
+ 'no-const-assign': 'error',
|
|
|
+ 'no-constant-condition': ['error', { checkLoops: false }],
|
|
|
+ 'no-debugger': 'error',
|
|
|
+ 'no-delete-var': 'error',
|
|
|
+ 'no-dupe-args': 'error',
|
|
|
+ 'no-dupe-keys': 'error',
|
|
|
+ 'no-duplicate-case': 'error',
|
|
|
+ 'no-useless-backreference': 'error',
|
|
|
+ 'no-empty': ['error', { allowEmptyCatch: true }],
|
|
|
+ 'no-empty-character-class': 'error',
|
|
|
+ 'no-empty-pattern': 'error',
|
|
|
+ 'no-eval': 'error',
|
|
|
+ 'no-ex-assign': 'error',
|
|
|
+ 'no-extend-native': 'error',
|
|
|
+ 'no-extra-bind': 'error',
|
|
|
+ 'no-extra-boolean-cast': 'error',
|
|
|
+ 'no-fallthrough': 'error',
|
|
|
+ 'no-func-assign': 'error',
|
|
|
+ 'no-global-assign': 'error',
|
|
|
+ 'no-implied-eval': 'error',
|
|
|
+ 'no-import-assign': 'error',
|
|
|
+ 'no-invalid-regexp': 'error',
|
|
|
+ 'no-irregular-whitespace': 'error',
|
|
|
+ 'no-iterator': 'error',
|
|
|
+ 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
|
|
|
+ 'no-lone-blocks': 'error',
|
|
|
+ 'no-loss-of-precision': 'error',
|
|
|
+ 'no-misleading-character-class': 'error',
|
|
|
+ 'no-prototype-builtins': 'error',
|
|
|
+ 'no-useless-catch': 'error',
|
|
|
+ 'no-multi-str': 'error',
|
|
|
+ 'no-new': 'error',
|
|
|
+ 'no-new-func': 'error',
|
|
|
+ 'no-new-object': 'error',
|
|
|
+ 'no-new-symbol': 'error',
|
|
|
+ 'no-new-wrappers': 'error',
|
|
|
+ 'no-obj-calls': 'error',
|
|
|
+ 'no-octal': 'error',
|
|
|
+ 'no-octal-escape': 'error',
|
|
|
+ 'no-proto': 'error',
|
|
|
+ 'no-regex-spaces': 'error',
|
|
|
+ 'no-return-assign': ['error', 'except-parens'],
|
|
|
+ 'no-self-assign': ['error', { props: true }],
|
|
|
+ 'no-self-compare': 'error',
|
|
|
+ 'no-sequences': 'error',
|
|
|
+ 'no-shadow-restricted-names': 'error',
|
|
|
+ 'no-sparse-arrays': 'error',
|
|
|
+ 'no-template-curly-in-string': 'error',
|
|
|
+ 'no-this-before-super': 'error',
|
|
|
+ 'no-throw-literal': 'error',
|
|
|
+ 'no-undef': 'error',
|
|
|
+ 'no-undef-init': 'error',
|
|
|
+ 'no-unexpected-multiline': 'error',
|
|
|
+ 'no-unmodified-loop-condition': 'error',
|
|
|
+ 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
|
|
|
+ 'no-unreachable': 'error',
|
|
|
+ 'no-unreachable-loop': 'error',
|
|
|
+ 'no-unsafe-finally': 'error',
|
|
|
+ 'no-unsafe-negation': 'error',
|
|
|
+ 'no-unused-expressions': ['error', {
|
|
|
+ allowShortCircuit: true,
|
|
|
+ allowTernary: true,
|
|
|
+ allowTaggedTemplates: true,
|
|
|
+ }],
|
|
|
+ 'no-unused-vars': ['error', {
|
|
|
+ args: 'none',
|
|
|
+ caughtErrors: 'none',
|
|
|
+ ignoreRestSiblings: true,
|
|
|
+ vars: 'all',
|
|
|
+ }],
|
|
|
+ 'no-use-before-define': ['error', { functions: false, classes: false, variables: false }],
|
|
|
+ 'no-useless-call': 'error',
|
|
|
+ 'no-useless-computed-key': 'error',
|
|
|
+ 'no-useless-constructor': 'error',
|
|
|
+ 'no-useless-rename': 'error',
|
|
|
+ 'no-useless-return': 'error',
|
|
|
+ 'no-var': 'error',
|
|
|
+ 'no-void': 'error',
|
|
|
+ 'no-with': 'error',
|
|
|
+ 'object-shorthand': ['warn', 'properties'],
|
|
|
+ 'prefer-const': ['error', { destructuring: 'all' }],
|
|
|
+ 'prefer-promise-reject-errors': 'error',
|
|
|
+ 'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
|
|
|
+ 'symbol-description': 'error',
|
|
|
+ 'unicode-bom': ['error', 'never'],
|
|
|
+ 'use-isnan': ['error', {
|
|
|
+ enforceForSwitchCase: true,
|
|
|
+ enforceForIndexOf: true,
|
|
|
+ }],
|
|
|
+ 'valid-typeof': ['error', { requireStringLiterals: true }],
|
|
|
+ yoda: ['error', 'never'],
|
|
|
|
|
|
- indent: ['error', 2, {
|
|
|
+ '@stylistic/array-bracket-spacing': ['error', 'never'],
|
|
|
+ '@stylistic/arrow-spacing': ['error', { before: true, after: true }],
|
|
|
+ '@stylistic/block-spacing': ['error', 'always'],
|
|
|
+ '@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
|
+ camelcase: ['error', {
|
|
|
+ allow: ['^UNSAFE_'],
|
|
|
+ properties: 'never',
|
|
|
+ ignoreGlobals: true,
|
|
|
+ }],
|
|
|
+ '@stylistic/comma-dangle': ['error', 'always-multiline'],
|
|
|
+ '@stylistic/comma-spacing': ['error', { before: false, after: true }],
|
|
|
+ '@stylistic/comma-style': ['error', 'last'],
|
|
|
+ '@stylistic/computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],
|
|
|
+ '@stylistic/dot-location': ['error', 'property'],
|
|
|
+ '@stylistic/eol-last': 'error',
|
|
|
+ '@stylistic/func-call-spacing': ['error', 'never'],
|
|
|
+ '@stylistic/generator-star-spacing': ['error', { before: true, after: true }],
|
|
|
+ '@stylistic/indent': ['error', 2, {
|
|
|
SwitchCase: 1,
|
|
|
|
|
|
VariableDeclarator: {
|
|
|
- var: 2
|
|
|
+ var: 2,
|
|
|
},
|
|
|
|
|
|
- outerIIFEBody: 0
|
|
|
+ outerIIFEBody: 0,
|
|
|
}],
|
|
|
-
|
|
|
- 'operator-linebreak': ['error', 'before', {
|
|
|
+ '@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }],
|
|
|
+ '@stylistic/keyword-spacing': ['error', { before: true, after: true }],
|
|
|
+ '@stylistic/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
|
|
|
+ '@stylistic/multiline-ternary': ['error', 'always-multiline'],
|
|
|
+ '@stylistic/new-parens': 'error',
|
|
|
+ '@stylistic/no-extra-semi': 'error',
|
|
|
+ '@stylistic/no-extra-parens': ['error', 'functions'],
|
|
|
+ '@stylistic/no-floating-decimal': 'error',
|
|
|
+ '@stylistic/no-mixed-operators': ['error', {
|
|
|
+ groups: [
|
|
|
+ ['==', '!=', '===', '!==', '>', '>=', '<', '<='],
|
|
|
+ ['&&', '||'],
|
|
|
+ ['in', 'instanceof'],
|
|
|
+ ],
|
|
|
+ allowSamePrecedence: true,
|
|
|
+ }],
|
|
|
+ '@stylistic/no-mixed-spaces-and-tabs': 'error',
|
|
|
+ '@stylistic/no-multi-spaces': 'error',
|
|
|
+ '@stylistic/no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
|
+ '@stylistic/no-tabs': 'error',
|
|
|
+ '@stylistic/no-trailing-spaces': 'error',
|
|
|
+ '@stylistic/no-whitespace-before-property': 'error',
|
|
|
+ '@stylistic/object-curly-newline': ['error', { multiline: true, consistent: true }],
|
|
|
+ '@stylistic/object-curly-spacing': ['error', 'always'],
|
|
|
+ '@stylistic/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
|
|
|
+ '@stylistic/operator-linebreak': ['error', 'before', {
|
|
|
overrides: {
|
|
|
- '=': 'after'
|
|
|
- }
|
|
|
- }],
|
|
|
-
|
|
|
- 'space-before-function-paren': ['error', 'never'],
|
|
|
- 'no-cond-assign': 'off',
|
|
|
- 'no-useless-escape': 'off',
|
|
|
- 'one-var': 'off',
|
|
|
- 'no-control-regex': 'off',
|
|
|
- 'no-prototype-builtins': 'off',
|
|
|
- 'no-extra-semi': 'error',
|
|
|
- 'prefer-const': 'error',
|
|
|
- 'no-var': 'error',
|
|
|
+ '=': 'after',
|
|
|
+ },
|
|
|
+ }],
|
|
|
+ '@stylistic/padded-blocks': ['error', { blocks: 'never', switches: 'never', classes: 'never' }],
|
|
|
+ '@stylistic/quote-props': ['error', 'as-needed'],
|
|
|
+ '@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
|
|
|
+ '@stylistic/rest-spread-spacing': ['error', 'never'],
|
|
|
+ '@stylistic/semi': ['error', 'always'],
|
|
|
+ '@stylistic/semi-spacing': ['error', { before: false, after: true }],
|
|
|
+ '@stylistic/space-before-blocks': ['error', 'always'],
|
|
|
+ '@stylistic/space-before-function-paren': ['error', 'never'],
|
|
|
+ '@stylistic/space-in-parens': ['error', 'never'],
|
|
|
+ '@stylistic/space-infix-ops': 'error',
|
|
|
+ '@stylistic/space-unary-ops': ['error', { words: true, nonwords: false }],
|
|
|
+ '@stylistic/spaced-comment': ['error', 'always', {
|
|
|
+ line: { markers: ['*package', '!', '/', ',', '='] },
|
|
|
+ block: { balanced: true, markers: ['*package', '!', ',', ':', '::', 'flow-include'], exceptions: ['*'] },
|
|
|
+ }],
|
|
|
+ '@stylistic/template-curly-spacing': ['error', 'never'],
|
|
|
+ '@stylistic/template-tag-spacing': ['error', 'never'],
|
|
|
+ '@stylistic/wrap-iife': ['error', 'any', { functionPrototypeMethods: true }],
|
|
|
+ '@stylistic/yield-star-spacing': ['error', 'both'],
|
|
|
+
|
|
|
+ '@n/handle-callback-err': ['error', '^(err|error)$'],
|
|
|
+ '@n/no-callback-literal': 'error',
|
|
|
+ '@n/no-deprecated-api': 'error',
|
|
|
+ '@n/no-exports-assign': 'error',
|
|
|
+ '@n/no-new-require': 'error',
|
|
|
+ '@n/no-path-concat': 'error',
|
|
|
+ '@n/process-exit-as-throw': 'error',
|
|
|
+
|
|
|
'@typescript-eslint/ban-ts-comment': 'off',
|
|
|
- '@typescript-eslint/no-explicit-any': 'off',
|
|
|
- '@typescript-eslint/no-non-null-assertion': 'off',
|
|
|
- '@typescript-eslint/no-empty-function': 'off',
|
|
|
'@typescript-eslint/no-namespace': 'off',
|
|
|
-
|
|
|
'@typescript-eslint/no-unused-vars': ['error', {
|
|
|
- args: 'none'
|
|
|
- }]
|
|
|
- }
|
|
|
- }
|
|
|
+ args: 'none',
|
|
|
+ }],
|
|
|
+ },
|
|
|
+ },
|
|
|
];
|