|
| 1 | +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' |
| 2 | +import markdown from 'eslint-plugin-markdown' |
| 3 | +import tseslint from 'typescript-eslint' |
| 4 | +import process from 'process' |
| 5 | + |
| 6 | +export default [ |
| 7 | + eslintPluginPrettierRecommended, |
| 8 | + ...markdown.configs.recommended, |
| 9 | + { |
| 10 | + rules: { |
| 11 | + 'accessor-pairs': 2, |
| 12 | + 'brace-style': [2, '1tbs', { allowSingleLine: true }], |
| 13 | + camelcase: [2, { properties: 'never' }], |
| 14 | + 'comma-dangle': [2, 'never'], |
| 15 | + 'constructor-super': 2, |
| 16 | + curly: [2, 'multi-line'], |
| 17 | + eqeqeq: [2, 'allow-null'], |
| 18 | + 'handle-callback-err': [2, '^(err|error)$'], |
| 19 | + 'new-cap': [2, { newIsCap: true, capIsNew: false }], |
| 20 | + 'new-parens': 2, |
| 21 | + 'no-array-constructor': 2, |
| 22 | + 'no-caller': 2, |
| 23 | + 'no-class-assign': 2, |
| 24 | + 'no-cond-assign': 2, |
| 25 | + 'no-const-assign': 2, |
| 26 | + 'no-control-regex': 2, |
| 27 | + 'no-delete-var': 2, |
| 28 | + 'no-dupe-args': 2, |
| 29 | + 'no-dupe-class-members': 2, |
| 30 | + 'no-dupe-keys': 2, |
| 31 | + 'no-duplicate-case': 2, |
| 32 | + 'no-empty-character-class': 2, |
| 33 | + 'no-empty-pattern': 2, |
| 34 | + 'no-eval': 2, |
| 35 | + 'no-ex-assign': 2, |
| 36 | + 'no-extend-native': 2, |
| 37 | + 'no-extra-bind': 2, |
| 38 | + 'no-extra-boolean-cast': 2, |
| 39 | + 'no-extra-parens': [2, 'functions'], |
| 40 | + 'no-fallthrough': 2, |
| 41 | + 'no-floating-decimal': 2, |
| 42 | + 'no-func-assign': 2, |
| 43 | + 'no-implied-eval': 2, |
| 44 | + 'no-inner-declarations': [2, 'functions'], |
| 45 | + 'no-invalid-regexp': 2, |
| 46 | + 'no-irregular-whitespace': 2, |
| 47 | + 'no-iterator': 2, |
| 48 | + 'no-label-var': 2, |
| 49 | + 'no-labels': [2, { allowLoop: false, allowSwitch: false }], |
| 50 | + 'no-lone-blocks': 2, |
| 51 | + 'no-mixed-spaces-and-tabs': 2, |
| 52 | + 'no-multi-str': 2, |
| 53 | + 'no-native-reassign': 2, |
| 54 | + 'no-negated-in-lhs': 2, |
| 55 | + 'no-new-object': 2, |
| 56 | + 'no-new-require': 2, |
| 57 | + 'no-new-symbol': 2, |
| 58 | + 'no-new-wrappers': 2, |
| 59 | + 'no-obj-calls': 2, |
| 60 | + 'no-octal': 2, |
| 61 | + 'no-octal-escape': 2, |
| 62 | + 'no-path-concat': 2, |
| 63 | + 'no-proto': 2, |
| 64 | + 'no-redeclare': 2, |
| 65 | + 'no-regex-spaces': 2, |
| 66 | + 'no-return-assign': [2, 'except-parens'], |
| 67 | + 'no-self-assign': 2, |
| 68 | + 'no-self-compare': 2, |
| 69 | + 'no-sequences': 2, |
| 70 | + 'no-shadow-restricted-names': 2, |
| 71 | + 'no-spaced-func': 2, |
| 72 | + 'no-sparse-arrays': 2, |
| 73 | + 'no-this-before-super': 2, |
| 74 | + 'no-throw-literal': 2, |
| 75 | + 'no-trailing-spaces': 2, |
| 76 | + 'no-undef': 2, |
| 77 | + 'no-undef-init': 2, |
| 78 | + 'no-unexpected-multiline': 2, |
| 79 | + 'no-unmodified-loop-condition': 2, |
| 80 | + 'no-unneeded-ternary': [2, { defaultAssignment: false }], |
| 81 | + 'no-unreachable': 2, |
| 82 | + 'no-unsafe-finally': 2, |
| 83 | + 'no-unused-vars': [2, { vars: 'all', args: 'none' }], |
| 84 | + 'no-useless-call': 2, |
| 85 | + 'no-useless-computed-key': 2, |
| 86 | + 'no-useless-constructor': 2, |
| 87 | + 'no-useless-escape': 0, |
| 88 | + 'no-whitespace-before-property': 2, |
| 89 | + 'no-with': 2, |
| 90 | + 'one-var': [2, { initialized: 'never' }], |
| 91 | + 'use-isnan': 2, |
| 92 | + 'valid-typeof': 2, |
| 93 | + 'wrap-iife': [2, 'any'], |
| 94 | + yoda: [2, 'never'], |
| 95 | + 'prefer-const': 2, |
| 96 | + 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, |
| 97 | + 'object-shorthand': 'error' |
| 98 | + } |
| 99 | + }, |
| 100 | + ...tseslint.config({ |
| 101 | + files: ['*.ts'], |
| 102 | + extends: [...tseslint.configs.recommended], |
| 103 | + rules: { |
| 104 | + '@typescript-eslint/no-non-null-assertion': 'off', |
| 105 | + '@typescript-eslint/consistent-type-imports': 'error' |
| 106 | + }, |
| 107 | + languageOptions: { |
| 108 | + parserOptions: { |
| 109 | + parser: tseslint.parser |
| 110 | + } |
| 111 | + } |
| 112 | + }), |
| 113 | + { |
| 114 | + files: ['*.vue'], |
| 115 | + parser: 'vue-eslint-parser', |
| 116 | + languageOptions: { |
| 117 | + ecmaVersion: 2021, |
| 118 | + sourceType: 'module' |
| 119 | + } |
| 120 | + }, |
| 121 | + { |
| 122 | + files: ['js', 'ts', 'vue', 'svelte'].map(ext => [`**/*.md/*.${ext}`]), |
| 123 | + processor: 'markdown/markdown', |
| 124 | + rules: { |
| 125 | + 'prettier/prettier': 'off' |
| 126 | + } |
| 127 | + }, |
| 128 | + { |
| 129 | + ignores: [ |
| 130 | + '!docs/.vuepress/', |
| 131 | + '!.github/', |
| 132 | + '!.vscode/', |
| 133 | + '.nyc_output/', |
| 134 | + 'assets/', |
| 135 | + 'coverage/', |
| 136 | + 'dist/', |
| 137 | + 'docs/.vuepress/dist/', |
| 138 | + 'node_modules/', |
| 139 | + 'tests-integrations/' |
| 140 | + ] |
| 141 | + } |
| 142 | +] |
0 commit comments