@ocavue/eslint-config 2.15.1 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/antfu.d.ts +2 -0
  2. package/dist/antfu.js +15 -0
  3. package/dist/basic.d.ts +2 -0
  4. package/dist/basic.js +20 -0
  5. package/dist/ignores.d.ts +2 -0
  6. package/dist/ignores.js +5 -0
  7. package/dist/imports.d.ts +2 -0
  8. package/dist/imports.js +49 -0
  9. package/dist/index.d.ts +6 -7
  10. package/dist/index.js +6 -0
  11. package/dist/markdown.d.ts +2 -0
  12. package/dist/markdown.js +41 -0
  13. package/dist/no-only-tests.d.ts +2 -0
  14. package/dist/no-only-tests.js +14 -0
  15. package/dist/package-json.d.ts +5 -0
  16. package/dist/package-json.js +70 -0
  17. package/dist/{src/prettier.d.ts → prettier.d.ts} +2 -2
  18. package/{src → dist}/prettier.js +9 -13
  19. package/dist/react.d.ts +2 -0
  20. package/dist/react.js +34 -0
  21. package/dist/shared.d.ts +23 -0
  22. package/dist/shared.js +49 -0
  23. package/dist/typescript.d.ts +4 -0
  24. package/dist/typescript.js +112 -0
  25. package/dist/unicorn.d.ts +2 -0
  26. package/dist/unicorn.js +71 -0
  27. package/dist/vue.d.ts +2 -0
  28. package/dist/vue.js +33 -0
  29. package/package.json +20 -23
  30. package/dist/eslint.config.d.ts +0 -3
  31. package/dist/eslint.config.d.ts.map +0 -1
  32. package/dist/index.d.ts.map +0 -1
  33. package/dist/src/antfu.d.ts +0 -2
  34. package/dist/src/antfu.d.ts.map +0 -1
  35. package/dist/src/basic.d.ts +0 -2
  36. package/dist/src/basic.d.ts.map +0 -1
  37. package/dist/src/ignores.d.ts +0 -2
  38. package/dist/src/ignores.d.ts.map +0 -1
  39. package/dist/src/imports.d.ts +0 -2
  40. package/dist/src/imports.d.ts.map +0 -1
  41. package/dist/src/markdown.d.ts +0 -2
  42. package/dist/src/markdown.d.ts.map +0 -1
  43. package/dist/src/no-only-tests.d.ts +0 -2
  44. package/dist/src/no-only-tests.d.ts.map +0 -1
  45. package/dist/src/package-json.d.ts +0 -5
  46. package/dist/src/package-json.d.ts.map +0 -1
  47. package/dist/src/prettier.d.ts.map +0 -1
  48. package/dist/src/react.d.ts +0 -2
  49. package/dist/src/react.d.ts.map +0 -1
  50. package/dist/src/shared.d.ts +0 -24
  51. package/dist/src/shared.d.ts.map +0 -1
  52. package/dist/src/typescript.d.ts +0 -4
  53. package/dist/src/typescript.d.ts.map +0 -1
  54. package/dist/src/unicorn.d.ts +0 -2
  55. package/dist/src/unicorn.d.ts.map +0 -1
  56. package/dist/src/vue.d.ts +0 -2
  57. package/dist/src/vue.d.ts.map +0 -1
  58. package/index.js +0 -6
  59. package/src/antfu.js +0 -19
  60. package/src/basic.js +0 -26
  61. package/src/ignores.js +0 -10
  62. package/src/imports.js +0 -55
  63. package/src/markdown.js +0 -63
  64. package/src/no-only-tests.js +0 -20
  65. package/src/package-json.js +0 -78
  66. package/src/react.js +0 -45
  67. package/src/shared.js +0 -61
  68. package/src/typescript.js +0 -127
  69. package/src/unicorn.js +0 -75
  70. package/src/vue.js +0 -46
package/src/typescript.js DELETED
@@ -1,127 +0,0 @@
1
- // @ts-check
2
-
3
- import eslint from '@eslint/js'
4
- import tseslint from 'typescript-eslint'
5
-
6
- import { GLOB_JS, GLOB_JSX, GLOB_TEST, GLOB_TS, GLOB_TSX } from './shared.js'
7
-
8
- export { tseslint }
9
-
10
- export function typescript() {
11
- const rules = [...tseslint.configs.recommended, ...tseslint.configs.stylistic]
12
- .map((config) => config.rules || {})
13
- .reduce((acc, cur) => ({ ...acc, ...cur }), {})
14
-
15
- /** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray} */
16
- const config = [
17
- eslint.configs.recommended,
18
- {
19
- name: 'typescript',
20
- files: [GLOB_TS, GLOB_TSX, GLOB_JS, GLOB_JSX],
21
- languageOptions: {
22
- parser: tseslint.parser,
23
- parserOptions: {
24
- projectService: true,
25
- sourceType: 'module',
26
- ecmaVersion: 'latest',
27
- },
28
- },
29
- plugins: {
30
- '@typescript-eslint': tseslint.plugin,
31
- },
32
- rules: {
33
- ...rules,
34
-
35
- '@typescript-eslint/consistent-type-definitions': 'off',
36
- '@typescript-eslint/prefer-optional-chain': 'off',
37
- '@typescript-eslint/prefer-nullish-coalescing': 'off',
38
- '@typescript-eslint/consistent-indexed-object-style': 'off',
39
- '@typescript-eslint/array-type': 'off',
40
- '@typescript-eslint/dot-notation': 'off',
41
- '@typescript-eslint/triple-slash-reference': 'off',
42
- '@typescript-eslint/consistent-type-imports': [
43
- 'warn',
44
- {
45
- fixStyle: 'inline-type-imports',
46
- },
47
- ],
48
- '@typescript-eslint/no-import-type-side-effects': 'warn',
49
- '@typescript-eslint/no-unnecessary-type-assertion': 'warn',
50
- '@typescript-eslint/no-unnecessary-parameter-property-assignment':
51
- 'warn',
52
- '@typescript-eslint/restrict-plus-operands': 'warn',
53
- '@typescript-eslint/no-unsafe-call': 'warn',
54
- '@typescript-eslint/no-unsafe-return': 'warn',
55
- '@typescript-eslint/no-unsafe-argument': 'warn',
56
- '@typescript-eslint/no-unsafe-member-access': 'warn',
57
- '@typescript-eslint/no-unsafe-assignment': 'warn',
58
- '@typescript-eslint/no-floating-promises': 'warn',
59
- '@typescript-eslint/no-explicit-any': 'warn',
60
- '@typescript-eslint/explicit-module-boundary-types': 'off',
61
- '@typescript-eslint/no-non-null-assertion': 'off',
62
- '@typescript-eslint/restrict-template-expressions': 'off',
63
- '@typescript-eslint/no-unused-vars': [
64
- 'error',
65
- {
66
- argsIgnorePattern: '^_',
67
- varsIgnorePattern: '^_',
68
- caughtErrorsIgnorePattern: '^_',
69
- },
70
- ],
71
- '@typescript-eslint/no-extra-semi': 'off',
72
- '@typescript-eslint/prefer-function-type': 'warn',
73
-
74
- '@typescript-eslint/no-misused-promises': [
75
- 'error',
76
- { checksVoidReturn: false },
77
- ],
78
- '@typescript-eslint/await-thenable': 'error',
79
- '@typescript-eslint/unbound-method': 'error',
80
-
81
- // `type T1 = T0` and `interface T2 extends T0 {}` have the same meaning
82
- // but different behavior in TypeScript type checking. `T1` and `T0` are
83
- // the same type, while `T2` is different than `T0`. We allow `interface
84
- // T2 extends T0 {}` explicitly.
85
- '@typescript-eslint/no-empty-object-type': [
86
- 'error',
87
- {
88
- allowInterfaces: 'with-single-extends',
89
- },
90
- ],
91
-
92
- // Turn off this rule because it's incompatible with the `--isolatedDeclarations` compiler option.
93
- '@typescript-eslint/no-inferrable-types': 'off',
94
-
95
- // TODO: We should set the rule below to error in the future
96
- '@typescript-eslint/require-await': 'warn',
97
- },
98
- },
99
- {
100
- name: 'typescript-js',
101
- files: [GLOB_JS, GLOB_JSX],
102
- rules: {
103
- '@typescript-eslint/no-require-imports': 'off',
104
- '@typescript-eslint/no-var-requires': 'off',
105
- },
106
- },
107
- {
108
- name: 'typescript-test',
109
- files: [GLOB_TEST],
110
- rules: {
111
- '@typescript-eslint/no-unsafe-call': 'warn',
112
- '@typescript-eslint/no-unsafe-return': 'warn',
113
- '@typescript-eslint/no-unsafe-argument': 'warn',
114
- '@typescript-eslint/no-unsafe-member-access': 'warn',
115
- '@typescript-eslint/no-unsafe-assignment': 'warn',
116
- '@typescript-eslint/no-explicit-any': 'off',
117
- '@typescript-eslint/no-empty-function': 'off',
118
- },
119
- },
120
- ]
121
-
122
- /** @type {import('eslint').Linter.Config[]} */
123
- // @ts-expect-error: unmatched type
124
- const configTyped = config
125
-
126
- return configTyped
127
- }
package/src/unicorn.js DELETED
@@ -1,75 +0,0 @@
1
- // @ts-check
2
-
3
- import plugin from 'eslint-plugin-unicorn'
4
-
5
- export function unicorn() {
6
- /** @type {import('eslint').Linter.Config[]} */
7
- const config = [
8
- {
9
- name: 'unicorn',
10
- plugins: {
11
- unicorn: plugin,
12
- },
13
- rules: {
14
- // Pass error message when throwing errors
15
- 'unicorn/error-message': 'error',
16
- // Uppercase regex escapes
17
- 'unicorn/escape-case': 'error',
18
- // Array.isArray instead of instanceof etc
19
- 'unicorn/no-instanceof-builtins': 'error',
20
- // Prevent deprecated `new Buffer()`
21
- 'unicorn/no-new-buffer': 'error',
22
- // Keep regex literals safe!
23
- 'unicorn/no-unsafe-regex': 'off',
24
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
25
- 'unicorn/number-literal-case': 'error',
26
- // includes over indexOf when checking for existence
27
- 'unicorn/prefer-includes': 'error',
28
- // String methods startsWith/endsWith instead of more complicated stuff
29
- 'unicorn/prefer-string-starts-ends-with': 'error',
30
- // Enforce throwing type error when throwing error while checking typeof
31
- 'unicorn/prefer-type-error': 'error',
32
- // Use new when throwing error
33
- 'unicorn/throw-new-error': 'error',
34
- // Prefer using the node: protocol
35
- 'unicorn/prefer-node-protocol': 'error',
36
- // Enforce explicitly comparing the length or size property of a value
37
- 'unicorn/explicit-length-check': 'error',
38
- // Prefer `.flatMap(…)` over `.map(…).flat()`
39
- 'unicorn/prefer-array-index-of': 'error',
40
- // Improve regexes
41
- 'unicorn/better-regex': 'error',
42
- // Enforce combining multiple `Array#push()` into one call.
43
- 'unicorn/no-array-push-push': 'warn',
44
- // Do not use a `for` loop that can be replaced with a `for-of` loop.
45
- 'unicorn/no-for-loop': 'error',
46
- // Disallow eslint-disable comments without specific rule names
47
- 'unicorn/no-abusive-eslint-disable': 'error',
48
- // Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.
49
- 'unicorn/prefer-add-event-listener': 'error',
50
- // Prefer `.find(…)` and `.findLast(…)` over the first or last element from
51
- 'unicorn/prefer-array-find': 'error',
52
- // Prefer `.flatMap(…)` over `.map(…).flat()`.
53
- 'unicorn/prefer-array-flat-map': 'error',
54
- // Prefer `.some(…)` over `.filter(…).length` check
55
- 'unicorn/prefer-array-some': 'error',
56
- // Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`
57
- 'unicorn/prefer-keyboard-event-key': 'error',
58
- // Enforce the use of `Math.trunc` instead of bitwise operators.
59
- 'unicorn/prefer-math-trunc': 'error',
60
- // Prefer negative index over `.length - index` when possible
61
- 'unicorn/prefer-negative-index': 'error',
62
- // Prefer `Number` static properties over global ones.
63
- 'unicorn/prefer-number-properties': 'warn',
64
- // Prefer `RegExp#test()` over `String#match()` and `RegExp#exec()`
65
- 'unicorn/prefer-regexp-test': 'warn',
66
- // Prefer using `structuredClone` to create a deep clone
67
- 'unicorn/prefer-structured-clone': 'warn',
68
- // Prefer using the `String.raw` tag to avoid escaping `\`
69
- 'unicorn/prefer-string-raw': 'warn',
70
- },
71
- },
72
- ]
73
-
74
- return config
75
- }
package/src/vue.js DELETED
@@ -1,46 +0,0 @@
1
- // @ts-check
2
-
3
- import prettierConfig from 'eslint-config-prettier'
4
- import vuePlugin from 'eslint-plugin-vue'
5
- import globals from 'globals'
6
- import tseslint from 'typescript-eslint'
7
-
8
- import { GLOB_VUE } from './shared.js'
9
-
10
- /** @type {import('eslint').Linter.Config[]} */
11
- const vueRecommended = vuePlugin.configs['flat/recommended']
12
-
13
- export function vue() {
14
- /** @type {import('eslint').Linter.Config[]} */
15
- const config = [
16
- ...vueRecommended,
17
- {
18
- name: 'vue:language-options',
19
- files: [GLOB_VUE],
20
- languageOptions: {
21
- ecmaVersion: 'latest',
22
- sourceType: 'module',
23
- globals: globals.browser,
24
- parserOptions: {
25
- parser: tseslint.parser,
26
- },
27
- },
28
- },
29
- {
30
- name: 'vue:rules-override',
31
- rules: {
32
- ...Object.fromEntries(
33
- Object.entries(prettierConfig.rules)
34
- .filter(([key]) => key.startsWith('vue/'))
35
- .map(([key, value]) => [key, value]),
36
- ),
37
-
38
- 'vue/multi-word-component-names': 'off',
39
- 'vue/one-component-per-file': 'off',
40
- 'vue/require-prop-types': 'off',
41
- },
42
- },
43
- ]
44
-
45
- return config
46
- }