|
1 | | -import antfu from '@antfu/eslint-config' |
| 1 | +import antfu, { GLOB_SRC } from '@antfu/eslint-config' |
2 | 2 |
|
3 | | -export default antfu({ |
4 | | - stylistic: true, |
5 | | - typescript: true, |
6 | | - vue: true, |
7 | | - jsonc: false, |
8 | | - yaml: false, |
9 | | - ignores: [ |
10 | | - 'dist', |
11 | | - 'node_modules', |
12 | | - '*.svelte', |
13 | | - '*.snap', |
14 | | - '*.d.ts', |
15 | | - 'coverage', |
16 | | - '!.vitepress', |
17 | | - ], |
18 | | - rules: { |
19 | | - 'no-restricted-globals': 'off', |
20 | | - 'no-empty-pattern': 'off', |
21 | | - }, |
22 | | -}) |
| 3 | +export default antfu( |
| 4 | + { |
| 5 | + vue: true, |
| 6 | + // Disable tests rules because we need to test with various setup |
| 7 | + test: false, |
| 8 | + // This replaces the old `.gitignore` |
| 9 | + ignores: [ |
| 10 | + '**/coverage', |
| 11 | + '**/*.snap', |
| 12 | + '**/bench.json', |
| 13 | + '**/fixtures', |
| 14 | + '**/assets/**', |
| 15 | + '**/*.d.ts', |
| 16 | + '**/*.timestamp-*', |
| 17 | + 'test/core/src/self', |
| 18 | + 'test/core/test/mocking/already-hoisted.test.ts', |
| 19 | + 'test/cache/cache/.vitest-base/results.json', |
| 20 | + 'test/core/src/wasm/wasm-bindgen-no-cyclic', |
| 21 | + 'test/workspaces/results.json', |
| 22 | + 'test/workspaces-browser/results.json', |
| 23 | + 'test/reporters/fixtures/with-syntax-error.test.js', |
| 24 | + 'test/network-imports/public/slash@3.0.0.js', |
| 25 | + 'test/coverage-test/src/transpiled.js', |
| 26 | + 'test/coverage-test/src/original.ts', |
| 27 | + 'test/cli/deps/error/*', |
| 28 | + 'examples/**/mockServiceWorker.js', |
| 29 | + 'examples/sveltekit/.svelte-kit', |
| 30 | + 'packages/browser/**/esm-client-injector.js', |
| 31 | + // contains technically invalid code to display pretty diff |
| 32 | + 'docs/guide/snapshot.md', |
| 33 | + // uses invalid js example |
| 34 | + 'docs/advanced/api/import-example.md', |
| 35 | + 'docs/guide/examples/*.md', |
| 36 | + ], |
| 37 | + }, |
| 38 | + { |
| 39 | + rules: { |
| 40 | + // prefer global Buffer to not initialize the whole module |
| 41 | + 'node/prefer-global/buffer': 'off', |
| 42 | + 'node/prefer-global/process': 'off', |
| 43 | + 'no-empty-pattern': 'off', |
| 44 | + 'antfu/indent-binary-ops': 'off', |
| 45 | + 'unused-imports/no-unused-imports': 'error', |
| 46 | + 'style/member-delimiter-style': [ |
| 47 | + 'error', |
| 48 | + { |
| 49 | + multiline: { delimiter: 'none' }, |
| 50 | + singleline: { delimiter: 'semi' }, |
| 51 | + }, |
| 52 | + ], |
| 53 | + // let TypeScript handle this |
| 54 | + 'no-undef': 'off', |
| 55 | + 'ts/no-invalid-this': 'off', |
| 56 | + 'eslint-comments/no-unlimited-disable': 'off', |
| 57 | + 'curly': ['error', 'all'], |
| 58 | + |
| 59 | + // TODO: migrate and turn it back on |
| 60 | + 'ts/ban-types': 'off', |
| 61 | + 'ts/no-unsafe-function-type': 'off', |
| 62 | + |
| 63 | + 'no-restricted-imports': [ |
| 64 | + 'error', |
| 65 | + { |
| 66 | + paths: ['path'], |
| 67 | + }, |
| 68 | + ], |
| 69 | + |
| 70 | + 'import/no-named-as-default': 'off', |
| 71 | + }, |
| 72 | + }, |
| 73 | + { |
| 74 | + files: [`packages/*/*.{js,mjs,d.ts}`], |
| 75 | + rules: { |
| 76 | + 'antfu/no-import-dist': 'off', |
| 77 | + }, |
| 78 | + }, |
| 79 | + { |
| 80 | + files: [`packages/${GLOB_SRC}`], |
| 81 | + rules: { |
| 82 | + 'no-restricted-imports': [ |
| 83 | + 'error', |
| 84 | + { |
| 85 | + paths: ['vitest', 'path', 'vitest/node'], |
| 86 | + }, |
| 87 | + ], |
| 88 | + }, |
| 89 | + }, |
| 90 | + { |
| 91 | + // these files define vitest as peer dependency |
| 92 | + files: [`packages/{coverage-*,ui,browser,web-worker,browser-*}/${GLOB_SRC}`], |
| 93 | + rules: { |
| 94 | + 'no-restricted-imports': [ |
| 95 | + 'error', |
| 96 | + { |
| 97 | + paths: ['path'], |
| 98 | + }, |
| 99 | + ], |
| 100 | + }, |
| 101 | + }, |
| 102 | + { |
| 103 | + files: [ |
| 104 | + `docs/${GLOB_SRC}`, |
| 105 | + `**/*.md`, |
| 106 | + `**/*.md/${GLOB_SRC}`, |
| 107 | + ], |
| 108 | + rules: { |
| 109 | + 'perfectionist/sort-imports': 'off', |
| 110 | + 'style/max-statements-per-line': 'off', |
| 111 | + 'import/newline-after-import': 'off', |
| 112 | + 'import/first': 'off', |
| 113 | + 'unused-imports/no-unused-imports': 'off', |
| 114 | + 'ts/method-signature-style': 'off', |
| 115 | + 'no-self-compare': 'off', |
| 116 | + 'import/no-mutable-exports': 'off', |
| 117 | + }, |
| 118 | + }, |
| 119 | + { |
| 120 | + files: [ |
| 121 | + `docs/${GLOB_SRC}`, |
| 122 | + `packages/web-worker/${GLOB_SRC}`, |
| 123 | + `test/core/${GLOB_SRC}`, |
| 124 | + ], |
| 125 | + rules: { |
| 126 | + 'no-restricted-globals': 'off', |
| 127 | + }, |
| 128 | + }, |
| 129 | + { |
| 130 | + files: [ |
| 131 | + `test/${GLOB_SRC}`, |
| 132 | + ], |
| 133 | + rules: { |
| 134 | + 'antfu/no-top-level-await': 'off', |
| 135 | + 'unicorn/consistent-function-scoping': 'off', |
| 136 | + }, |
| 137 | + }, |
| 138 | +) |
0 commit comments