@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
@@ -0,0 +1,2 @@
1
+ import type { Linter } from 'eslint';
2
+ export declare function antfu(): Linter.Config[];
package/dist/antfu.js ADDED
@@ -0,0 +1,15 @@
1
+ import antfuPlugin from 'eslint-plugin-antfu';
2
+ export function antfu() {
3
+ return [
4
+ {
5
+ name: 'antfu',
6
+ plugins: {
7
+ antfu: antfuPlugin,
8
+ },
9
+ rules: {
10
+ 'antfu/import-dedupe': 'error',
11
+ 'antfu/top-level-function': 'error',
12
+ },
13
+ },
14
+ ];
15
+ }
@@ -0,0 +1,2 @@
1
+ import type { Linter } from 'eslint';
2
+ export declare function basic(): Linter.Config[];
package/dist/basic.js ADDED
@@ -0,0 +1,20 @@
1
+ import { antfu } from './antfu.js';
2
+ import { ignores } from './ignores.js';
3
+ import { imports } from './imports.js';
4
+ import { noOnlyTests } from './no-only-tests.js';
5
+ import { packageJson } from './package-json.js';
6
+ import { prettier } from './prettier.js';
7
+ import { typescript } from './typescript.js';
8
+ import { unicorn } from './unicorn.js';
9
+ export function basic() {
10
+ return [
11
+ ...ignores(),
12
+ ...typescript(),
13
+ ...imports(),
14
+ ...packageJson(),
15
+ ...unicorn(),
16
+ ...antfu(),
17
+ ...noOnlyTests(),
18
+ ...prettier(),
19
+ ];
20
+ }
@@ -0,0 +1,2 @@
1
+ import type { Linter } from 'eslint';
2
+ export declare function ignores(): Linter.Config[];
@@ -0,0 +1,5 @@
1
+ import gitignore from 'eslint-config-flat-gitignore';
2
+ import { GLOB_EXCLUDE } from './shared.js';
3
+ export function ignores() {
4
+ return [{ ignores: [...GLOB_EXCLUDE] }, gitignore()];
5
+ }
@@ -0,0 +1,2 @@
1
+ import type { Linter } from 'eslint';
2
+ export declare function imports(): Linter.Config[];
@@ -0,0 +1,49 @@
1
+ import * as importPlugin from 'eslint-plugin-import-x';
2
+ export function imports() {
3
+ return [
4
+ {
5
+ name: 'import',
6
+ plugins: {
7
+ // @ts-expect-error incorrect type
8
+ import: importPlugin,
9
+ },
10
+ settings: {
11
+ 'import-x/resolver': {
12
+ // You will also need to install and configure the TypeScript resolver
13
+ // See also https://github.com/import-js/eslint-import-resolver-typescript#configuration
14
+ typescript: true,
15
+ node: true,
16
+ },
17
+ },
18
+ rules: {
19
+ // External modules must be declared in the package.json. Only enforced in CI.
20
+ 'import/no-extraneous-dependencies': process.env.CI ? 'error' : 'off',
21
+ 'import/first': 'warn',
22
+ 'import/no-mutable-exports': 'warn',
23
+ 'import/no-useless-path-segments': 'warn',
24
+ 'import/newline-after-import': 'warn',
25
+ // Disable `no-duplicates` because of the following bug
26
+ // https://github.com/un-ts/eslint-plugin-import-x/issues/167
27
+ // 'import/no-duplicates': [
28
+ // 'warn',
29
+ // { 'prefer-inline': true },
30
+ // ],
31
+ 'import/order': [
32
+ 'warn',
33
+ {
34
+ 'newlines-between': 'always',
35
+ alphabetize: { order: 'asc' },
36
+ groups: [
37
+ 'builtin',
38
+ 'external',
39
+ 'internal',
40
+ 'parent',
41
+ 'sibling',
42
+ 'index',
43
+ ],
44
+ },
45
+ ],
46
+ },
47
+ },
48
+ ];
49
+ }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- export * from "./src/typescript.js";
2
- export * from "./src/prettier.js";
3
- export * from "./src/basic.js";
4
- export * from "./src/markdown.js";
5
- export * from "./src/react.js";
6
- export * from "./src/vue.js";
7
- //# sourceMappingURL=index.d.ts.map
1
+ export * from './typescript.js';
2
+ export * from './prettier.js';
3
+ export * from './basic.js';
4
+ export * from './markdown.js';
5
+ export * from './react.js';
6
+ export * from './vue.js';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from './typescript.js';
2
+ export * from './prettier.js';
3
+ export * from './basic.js';
4
+ export * from './markdown.js';
5
+ export * from './react.js';
6
+ export * from './vue.js';
@@ -0,0 +1,2 @@
1
+ import type { Linter } from 'eslint';
2
+ export declare function markdown(): Linter.Config[];
@@ -0,0 +1,41 @@
1
+ import markdownPlugin from '@eslint/markdown';
2
+ import { GLOB_MARKDOWN, GLOB_SRC, GLOB_VUE } from './shared.js';
3
+ export function markdown() {
4
+ const recommended = markdownPlugin.configs.processor;
5
+ const extra = {
6
+ files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
7
+ languageOptions: {
8
+ parserOptions: {
9
+ projectService: null,
10
+ },
11
+ },
12
+ rules: {
13
+ // Disable type-aware TypeScript rules, because the code blocks are not
14
+ // part of a compilable `tsconfig.json` project.
15
+ '@typescript-eslint/no-redeclare': 'off',
16
+ '@typescript-eslint/no-unused-vars': 'off',
17
+ '@typescript-eslint/no-use-before-define': 'off',
18
+ '@typescript-eslint/no-var-requires': 'off',
19
+ '@typescript-eslint/restrict-plus-operands': 'off',
20
+ '@typescript-eslint/no-unsafe-call': 'off',
21
+ '@typescript-eslint/no-unsafe-return': 'off',
22
+ '@typescript-eslint/no-unsafe-argument': 'off',
23
+ '@typescript-eslint/no-unsafe-member-access': 'off',
24
+ '@typescript-eslint/no-unsafe-assignment': 'off',
25
+ '@typescript-eslint/no-floating-promises': 'off',
26
+ '@typescript-eslint/no-misused-promises': 'off',
27
+ '@typescript-eslint/await-thenable': 'off',
28
+ '@typescript-eslint/unbound-method': 'off',
29
+ '@typescript-eslint/require-await': 'off',
30
+ '@typescript-eslint/no-unnecessary-type-assertion': 'off',
31
+ // Disable some import rules because they are not working well with
32
+ // twoslash ---cut--- imports.
33
+ 'import/first': 'off',
34
+ 'import/order': 'off',
35
+ 'no-alert': 'off',
36
+ 'no-console': 'off',
37
+ 'no-restricted-imports': 'off',
38
+ },
39
+ };
40
+ return [...recommended, extra];
41
+ }
@@ -0,0 +1,2 @@
1
+ import type { Linter } from 'eslint';
2
+ export declare function noOnlyTests(): Linter.Config[];
@@ -0,0 +1,14 @@
1
+ import plugin from 'eslint-plugin-no-only-tests';
2
+ export function noOnlyTests() {
3
+ return [
4
+ {
5
+ name: 'no-only-tests',
6
+ plugins: {
7
+ 'no-only-tests': plugin,
8
+ },
9
+ rules: {
10
+ 'no-only-tests/no-only-tests': 'error',
11
+ },
12
+ },
13
+ ];
14
+ }
@@ -0,0 +1,5 @@
1
+ import type { Linter } from 'eslint';
2
+ /**
3
+ * Sort package.json keys
4
+ */
5
+ export declare function packageJson(): Linter.Config[];
@@ -0,0 +1,70 @@
1
+ import pkgJson from 'eslint-plugin-package-json';
2
+ /**
3
+ * Sort package.json keys
4
+ */
5
+ export function packageJson() {
6
+ const config = {
7
+ ...pkgJson.configs.recommended,
8
+ rules: {
9
+ ...pkgJson.configs.recommended.rules,
10
+ 'package-json/no-empty-fields': 'off',
11
+ 'package-json/valid-package-definition': 'off',
12
+ 'package-json/require-description': 'warn',
13
+ 'package-json/sort-collections': [
14
+ 'warn',
15
+ [
16
+ // 'scripts', // Don't sort scripts
17
+ 'devDependencies',
18
+ 'dependencies',
19
+ 'peerDependencies',
20
+ 'config',
21
+ 'exports',
22
+ ],
23
+ ],
24
+ 'package-json/order-properties': [
25
+ 'warn',
26
+ {
27
+ order: [
28
+ 'name',
29
+ 'displayName',
30
+ 'publisher',
31
+ 'type',
32
+ 'version',
33
+ 'private',
34
+ 'packageManager',
35
+ 'description',
36
+ 'author',
37
+ 'license',
38
+ 'funding',
39
+ 'homepage',
40
+ 'repository',
41
+ 'bugs',
42
+ 'contributes',
43
+ 'keywords',
44
+ 'categories',
45
+ 'sideEffects',
46
+ 'main',
47
+ 'module',
48
+ 'types',
49
+ 'exports',
50
+ 'typesVersions',
51
+ 'bin',
52
+ 'icon',
53
+ 'files',
54
+ 'engines',
55
+ 'scripts',
56
+ 'dependencies',
57
+ 'peerDependencies',
58
+ 'peerDependenciesMeta',
59
+ 'optionalDependencies',
60
+ 'devDependencies',
61
+ 'publishConfig',
62
+ 'overrides',
63
+ 'resolutions',
64
+ ],
65
+ },
66
+ ],
67
+ },
68
+ };
69
+ return [config];
70
+ }
@@ -1,8 +1,8 @@
1
+ import type { Linter } from 'eslint';
1
2
  /**
2
3
  * Turns off all rules that are unnecessary or might conflict with Prettier.
3
4
  *
4
5
  * Notice that this config does not run `prettier` as an ESLint rule, so you
5
6
  * have to run `pretter` separately for formatting.
6
7
  */
7
- export function prettier(): import("eslint").Linter.Config<import("eslint").Linter.RulesRecord>[];
8
- //# sourceMappingURL=prettier.d.ts.map
8
+ export declare function prettier(): Linter.Config[];
@@ -1,5 +1,4 @@
1
- import prettierConfig from 'eslint-config-prettier'
2
-
1
+ import prettierConfig from 'eslint-config-prettier';
3
2
  /**
4
3
  * Turns off all rules that are unnecessary or might conflict with Prettier.
5
4
  *
@@ -7,15 +6,12 @@ import prettierConfig from 'eslint-config-prettier'
7
6
  * have to run `pretter` separately for formatting.
8
7
  */
9
8
  export function prettier() {
10
- /** @type {import('eslint').Linter.Config[]} */
11
- const config = [
12
- {
13
- name: 'prettier',
14
- rules: {
15
- ...prettierConfig.rules,
16
- },
17
- },
18
- ]
19
-
20
- return config
9
+ return [
10
+ {
11
+ name: 'prettier',
12
+ rules: {
13
+ ...prettierConfig.rules,
14
+ },
15
+ },
16
+ ];
21
17
  }
@@ -0,0 +1,2 @@
1
+ import type { Linter } from 'eslint';
2
+ export declare function react(): Linter.Config[];
package/dist/react.js ADDED
@@ -0,0 +1,34 @@
1
+ import reactPlugin from 'eslint-plugin-react';
2
+ import reactHooksPlugin from 'eslint-plugin-react-hooks';
3
+ import { GLOB_TS, GLOB_TSX } from './shared.js';
4
+ export function react() {
5
+ const reactRecommended = reactPlugin.configs.flat?.recommended || {};
6
+ return [
7
+ {
8
+ ...reactRecommended,
9
+ name: 'react',
10
+ files: [GLOB_TS, GLOB_TSX],
11
+ settings: {
12
+ react: {
13
+ version: 'detect',
14
+ },
15
+ },
16
+ rules: {
17
+ ...reactRecommended.rules,
18
+ 'react/prop-types': 'off',
19
+ 'react/react-in-jsx-scope': 'off',
20
+ },
21
+ },
22
+ {
23
+ name: 'react-hooks',
24
+ files: [GLOB_TS, GLOB_TSX],
25
+ plugins: {
26
+ 'react-hooks': reactHooksPlugin,
27
+ },
28
+ rules: {
29
+ 'react-hooks/rules-of-hooks': 'error',
30
+ 'react-hooks/exhaustive-deps': 'warn',
31
+ },
32
+ },
33
+ ];
34
+ }
@@ -0,0 +1,23 @@
1
+ export declare const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
2
+ export declare const GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
3
+ export declare const GLOB_JS = "**/*.?([cm])js";
4
+ export declare const GLOB_JSX = "**/*.?([cm])jsx";
5
+ export declare const GLOB_TS = "**/*.?([cm])ts";
6
+ export declare const GLOB_TSX = "**/*.?([cm])tsx";
7
+ export declare const GLOB_TEST = "**/*.(spec|test).?([cm])[jt]s?(x)";
8
+ export declare const GLOB_STYLE = "**/*.{c,le,sc}ss";
9
+ export declare const GLOB_CSS = "**/*.css";
10
+ export declare const GLOB_LESS = "**/*.less";
11
+ export declare const GLOB_SCSS = "**/*.scss";
12
+ export declare const GLOB_JSON = "**/*.json";
13
+ export declare const GLOB_JSON5 = "**/*.json5";
14
+ export declare const GLOB_JSONC = "**/*.jsonc";
15
+ export declare const GLOB_MARKDOWN = "**/*.md";
16
+ export declare const GLOB_VUE = "**/*.vue";
17
+ export declare const GLOB_YAML = "**/*.y?(a)ml";
18
+ export declare const GLOB_HTML = "**/*.htm?(l)";
19
+ export declare const GLOB_ALL_SRC: readonly ["**/*.?([cm])[jt]s?(x)", "**/*.{c,le,sc}ss", "**/*.json", "**/*.json5", "**/*.md", "**/*.vue", "**/*.y?(a)ml", "**/*.htm?(l)"];
20
+ export declare const GLOB_NODE_MODULES: "**/node_modules";
21
+ export declare const GLOB_LOCKFILE: readonly ["**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml"];
22
+ export declare const GLOB_EXCLUDE: readonly ["**/node_modules", "**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml", "**/fixtures", "**/.changeset", "**/CHANGELOG*.md", "**/*.min.*", "**/LICENSE*", "**/__snapshots__", "**/.tsup"];
23
+ export declare const EXTENSIONS: string[];
package/dist/shared.js ADDED
@@ -0,0 +1,49 @@
1
+ export const GLOB_SRC_EXT = '?([cm])[jt]s?(x)';
2
+ export const GLOB_SRC = '**/*.?([cm])[jt]s?(x)';
3
+ export const GLOB_JS = '**/*.?([cm])js';
4
+ export const GLOB_JSX = '**/*.?([cm])jsx';
5
+ export const GLOB_TS = '**/*.?([cm])ts';
6
+ export const GLOB_TSX = '**/*.?([cm])tsx';
7
+ export const GLOB_TEST = '**/*.(spec|test).?([cm])[jt]s?(x)';
8
+ export const GLOB_STYLE = '**/*.{c,le,sc}ss';
9
+ export const GLOB_CSS = '**/*.css';
10
+ export const GLOB_LESS = '**/*.less';
11
+ export const GLOB_SCSS = '**/*.scss';
12
+ export const GLOB_JSON = '**/*.json';
13
+ export const GLOB_JSON5 = '**/*.json5';
14
+ export const GLOB_JSONC = '**/*.jsonc';
15
+ export const GLOB_MARKDOWN = '**/*.md';
16
+ export const GLOB_VUE = '**/*.vue';
17
+ export const GLOB_YAML = '**/*.y?(a)ml';
18
+ export const GLOB_HTML = '**/*.htm?(l)';
19
+ export const GLOB_ALL_SRC = [
20
+ GLOB_SRC,
21
+ GLOB_STYLE,
22
+ GLOB_JSON,
23
+ GLOB_JSON5,
24
+ GLOB_MARKDOWN,
25
+ GLOB_VUE,
26
+ GLOB_YAML,
27
+ GLOB_HTML,
28
+ ];
29
+ export const GLOB_NODE_MODULES = '**/node_modules';
30
+ export const GLOB_LOCKFILE = [
31
+ '**/package-lock.json',
32
+ '**/yarn.lock',
33
+ '**/pnpm-lock.yaml',
34
+ ];
35
+ export const GLOB_EXCLUDE = [
36
+ GLOB_NODE_MODULES,
37
+ ...GLOB_LOCKFILE,
38
+ '**/fixtures',
39
+ '**/.changeset',
40
+ '**/CHANGELOG*.md',
41
+ '**/*.min.*',
42
+ '**/LICENSE*',
43
+ '**/__snapshots__',
44
+ '**/.tsup',
45
+ ];
46
+ export const EXTENSIONS = ['ts', 'js']
47
+ .flatMap((ext) => [ext, ext + 'x'])
48
+ .flatMap((ext) => [ext, 'm' + ext, 'c' + ext])
49
+ .flatMap((ext) => [ext, 'd.' + ext]);
@@ -0,0 +1,4 @@
1
+ import type { Linter } from 'eslint';
2
+ import tseslint from 'typescript-eslint';
3
+ export { tseslint };
4
+ export declare function typescript(): Linter.Config[];
@@ -0,0 +1,112 @@
1
+ import eslint from '@eslint/js';
2
+ import tseslint from 'typescript-eslint';
3
+ import { GLOB_JS, GLOB_JSX, GLOB_TEST, GLOB_TS, GLOB_TSX } from './shared.js';
4
+ export { tseslint };
5
+ export function typescript() {
6
+ const rules = [...tseslint.configs.recommended, ...tseslint.configs.stylistic]
7
+ .map((config) => config.rules || {})
8
+ .reduce((acc, cur) => ({ ...acc, ...cur }), {});
9
+ const config = [
10
+ eslint.configs.recommended,
11
+ {
12
+ name: 'typescript',
13
+ files: [GLOB_TS, GLOB_TSX, GLOB_JS, GLOB_JSX],
14
+ languageOptions: {
15
+ parser: tseslint.parser,
16
+ parserOptions: {
17
+ projectService: true,
18
+ sourceType: 'module',
19
+ ecmaVersion: 'latest',
20
+ },
21
+ },
22
+ plugins: {
23
+ '@typescript-eslint': tseslint.plugin,
24
+ },
25
+ rules: {
26
+ ...rules,
27
+ '@typescript-eslint/consistent-type-definitions': 'off',
28
+ '@typescript-eslint/prefer-optional-chain': 'off',
29
+ '@typescript-eslint/prefer-nullish-coalescing': 'off',
30
+ '@typescript-eslint/consistent-indexed-object-style': 'off',
31
+ '@typescript-eslint/array-type': 'off',
32
+ '@typescript-eslint/dot-notation': 'off',
33
+ '@typescript-eslint/triple-slash-reference': 'off',
34
+ '@typescript-eslint/consistent-type-imports': [
35
+ 'warn',
36
+ {
37
+ // Allow type imports in type annotations (e.g. `type T = import('Foo').Foo`)
38
+ disallowTypeAnnotations: false,
39
+ },
40
+ ],
41
+ '@typescript-eslint/no-import-type-side-effects': 'warn',
42
+ '@typescript-eslint/no-unnecessary-type-assertion': 'warn',
43
+ '@typescript-eslint/no-unnecessary-parameter-property-assignment': 'warn',
44
+ '@typescript-eslint/restrict-plus-operands': 'warn',
45
+ '@typescript-eslint/no-unsafe-call': 'warn',
46
+ '@typescript-eslint/no-unsafe-return': 'warn',
47
+ '@typescript-eslint/no-unsafe-argument': 'warn',
48
+ '@typescript-eslint/no-unsafe-member-access': 'warn',
49
+ '@typescript-eslint/no-unsafe-assignment': 'warn',
50
+ '@typescript-eslint/no-floating-promises': 'warn',
51
+ '@typescript-eslint/no-explicit-any': 'warn',
52
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
53
+ '@typescript-eslint/no-non-null-assertion': 'off',
54
+ '@typescript-eslint/restrict-template-expressions': 'off',
55
+ '@typescript-eslint/no-unused-vars': [
56
+ 'error',
57
+ {
58
+ argsIgnorePattern: '^_',
59
+ varsIgnorePattern: '^_',
60
+ caughtErrorsIgnorePattern: '^_',
61
+ },
62
+ ],
63
+ '@typescript-eslint/no-extra-semi': 'off',
64
+ '@typescript-eslint/prefer-function-type': 'warn',
65
+ '@typescript-eslint/no-misused-promises': [
66
+ 'error',
67
+ { checksVoidReturn: false },
68
+ ],
69
+ '@typescript-eslint/await-thenable': 'error',
70
+ '@typescript-eslint/unbound-method': 'error',
71
+ // `type T1 = T0` and `interface T2 extends T0 {}` have the same meaning
72
+ // but different behavior in TypeScript type checking. `T1` and `T0` are
73
+ // the same type, while `T2` is different than `T0`. We allow `interface
74
+ // T2 extends T0 {}` explicitly.
75
+ '@typescript-eslint/no-empty-object-type': [
76
+ 'error',
77
+ {
78
+ allowInterfaces: 'with-single-extends',
79
+ },
80
+ ],
81
+ // Turn off this rule because it's incompatible with the `--isolatedDeclarations` compiler option.
82
+ '@typescript-eslint/no-inferrable-types': 'off',
83
+ // TODO: We should set the rule below to error in the future
84
+ '@typescript-eslint/require-await': 'warn',
85
+ },
86
+ },
87
+ {
88
+ name: 'typescript-js',
89
+ files: [GLOB_JS, GLOB_JSX],
90
+ rules: {
91
+ '@typescript-eslint/no-require-imports': 'off',
92
+ '@typescript-eslint/no-var-requires': 'off',
93
+ },
94
+ },
95
+ {
96
+ name: 'typescript-test',
97
+ files: [GLOB_TEST],
98
+ rules: {
99
+ '@typescript-eslint/no-unsafe-call': 'warn',
100
+ '@typescript-eslint/no-unsafe-return': 'warn',
101
+ '@typescript-eslint/no-unsafe-argument': 'warn',
102
+ '@typescript-eslint/no-unsafe-member-access': 'warn',
103
+ '@typescript-eslint/no-unsafe-assignment': 'warn',
104
+ '@typescript-eslint/no-explicit-any': 'off',
105
+ '@typescript-eslint/no-empty-function': 'off',
106
+ },
107
+ },
108
+ ];
109
+ // @ts-expect-error: unmatched type
110
+ const configTyped = config;
111
+ return configTyped;
112
+ }
@@ -0,0 +1,2 @@
1
+ import type { Linter } from 'eslint';
2
+ export declare function unicorn(): Linter.Config[];
@@ -0,0 +1,71 @@
1
+ import plugin from 'eslint-plugin-unicorn';
2
+ export function unicorn() {
3
+ return [
4
+ {
5
+ name: 'unicorn',
6
+ plugins: {
7
+ unicorn: plugin,
8
+ },
9
+ rules: {
10
+ // Pass error message when throwing errors
11
+ 'unicorn/error-message': 'error',
12
+ // Uppercase regex escapes
13
+ 'unicorn/escape-case': 'error',
14
+ // Array.isArray instead of instanceof etc
15
+ 'unicorn/no-instanceof-builtins': 'error',
16
+ // Prevent deprecated `new Buffer()`
17
+ 'unicorn/no-new-buffer': 'error',
18
+ // Keep regex literals safe!
19
+ 'unicorn/no-unsafe-regex': 'off',
20
+ // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
21
+ 'unicorn/number-literal-case': 'error',
22
+ // includes over indexOf when checking for existence
23
+ 'unicorn/prefer-includes': 'error',
24
+ // String methods startsWith/endsWith instead of more complicated stuff
25
+ 'unicorn/prefer-string-starts-ends-with': 'error',
26
+ // Enforce throwing type error when throwing error while checking typeof
27
+ 'unicorn/prefer-type-error': 'error',
28
+ // Use new when throwing error
29
+ 'unicorn/throw-new-error': 'error',
30
+ // Prefer using the node: protocol
31
+ 'unicorn/prefer-node-protocol': 'error',
32
+ // Enforce explicitly comparing the length or size property of a value
33
+ 'unicorn/explicit-length-check': 'error',
34
+ // Prefer `.flatMap(…)` over `.map(…).flat()`
35
+ 'unicorn/prefer-array-index-of': 'error',
36
+ // Improve regexes
37
+ 'unicorn/better-regex': 'error',
38
+ // Enforce combining multiple `Array#push()` into one call.
39
+ 'unicorn/prefer-single-call': 'warn',
40
+ // Do not use a `for` loop that can be replaced with a `for-of` loop.
41
+ 'unicorn/no-for-loop': 'error',
42
+ // Disallow eslint-disable comments without specific rule names
43
+ 'unicorn/no-abusive-eslint-disable': 'error',
44
+ // Prefer `.addEventListener()` and `.removeEventListener()` over `on`-functions.
45
+ 'unicorn/prefer-add-event-listener': 'error',
46
+ // Prefer `.find(…)` and `.findLast(…)` over the first or last element from
47
+ 'unicorn/prefer-array-find': 'error',
48
+ // Prefer `.flatMap(…)` over `.map(…).flat()`.
49
+ 'unicorn/prefer-array-flat-map': 'error',
50
+ // Prefer `.some(…)` over `.filter(…).length` check
51
+ 'unicorn/prefer-array-some': 'error',
52
+ // Prefer `KeyboardEvent#key` over `KeyboardEvent#keyCode`
53
+ 'unicorn/prefer-keyboard-event-key': 'error',
54
+ // Enforce the use of `Math.trunc` instead of bitwise operators.
55
+ 'unicorn/prefer-math-trunc': 'error',
56
+ // Prefer negative index over `.length - index` when possible
57
+ 'unicorn/prefer-negative-index': 'error',
58
+ // Prefer `Number` static properties over global ones.
59
+ 'unicorn/prefer-number-properties': 'warn',
60
+ // Prefer `RegExp#test()` over `String#match()` and `RegExp#exec()`
61
+ 'unicorn/prefer-regexp-test': 'warn',
62
+ // Prefer using `structuredClone` to create a deep clone
63
+ 'unicorn/prefer-structured-clone': 'warn',
64
+ // Prefer using the `String.raw` tag to avoid escaping `\`
65
+ 'unicorn/prefer-string-raw': 'warn',
66
+ // Prefer `import.meta.dirname` over `path.dirname(fileURLToPath(import.meta.url))`
67
+ 'unicorn/prefer-import-meta-properties': 'warn',
68
+ },
69
+ },
70
+ ];
71
+ }
package/dist/vue.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { Linter } from 'eslint';
2
+ export declare function vue(): Linter.Config[];