@tanstack/eslint-config 0.3.2 → 0.3.4
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.
- package/dist/import.js +25 -0
- package/dist/import.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/javascript.js +55 -0
- package/dist/javascript.js.map +1 -0
- package/dist/node.js +9 -0
- package/dist/node.js.map +1 -0
- package/dist/stylistic.js +9 -0
- package/dist/stylistic.js.map +1 -0
- package/dist/typescript.js +45 -0
- package/dist/typescript.js.map +1 -0
- package/package.json +15 -11
- package/src/{import.js → import.ts} +5 -3
- package/src/{index.js → index.ts} +2 -2
- package/src/{javascript.js → javascript.ts} +5 -3
- package/src/node.ts +9 -0
- package/src/stylistic.ts +9 -0
- package/src/{typescript.js → typescript.ts} +5 -3
- package/src/node.js +0 -7
- package/src/stylistic.js +0 -7
package/dist/import.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/import.ts
|
|
2
|
+
/**
|
|
3
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x
|
|
4
|
+
*/
|
|
5
|
+
const importRules = {
|
|
6
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
7
|
+
"import/first": "error",
|
|
8
|
+
"import/newline-after-import": "error",
|
|
9
|
+
"import/no-commonjs": "error",
|
|
10
|
+
"import/no-duplicates": "error",
|
|
11
|
+
"import/order": ["error", { groups: [
|
|
12
|
+
"builtin",
|
|
13
|
+
"external",
|
|
14
|
+
"internal",
|
|
15
|
+
"parent",
|
|
16
|
+
"sibling",
|
|
17
|
+
"index",
|
|
18
|
+
"object",
|
|
19
|
+
"type"
|
|
20
|
+
] }]
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { importRules };
|
|
25
|
+
//# sourceMappingURL=import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.js","names":["importRules: Linter.RulesRecord"],"sources":["../src/import.ts"],"sourcesContent":["import type { Linter } from 'eslint'\n\n/**\n * @see https://github.com/un-ts/eslint-plugin-import-x\n */\nexport const importRules: Linter.RulesRecord = {\n /** Bans the use of inline type-only markers for named imports */\n 'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],\n /** Reports any imports that come after non-import statements */\n 'import/first': 'error',\n /** Stylistic preference */\n 'import/newline-after-import': 'error',\n /** No require() or module.exports */\n 'import/no-commonjs': 'error',\n /** Reports if a resolved path is imported more than once */\n 'import/no-duplicates': 'error',\n /** Stylistic preference */\n 'import/order': [\n 'error',\n {\n groups: [\n 'builtin',\n 'external',\n 'internal',\n 'parent',\n 'sibling',\n 'index',\n 'object',\n 'type',\n ],\n },\n ],\n}\n"],"mappings":";;;;AAKA,MAAaA,cAAkC;CAE7C,0CAA0C,CAAC,SAAS,mBAAmB;CAEvE,gBAAgB;CAEhB,+BAA+B;CAE/B,sBAAsB;CAEtB,wBAAwB;CAExB,gBAAgB,CACd,SACA,EACE,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,EACF,CACF;CACF"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { javascriptRules } from "./javascript.js";
|
|
2
|
+
import { importRules } from "./import.js";
|
|
3
|
+
import { typescriptRules } from "./typescript.js";
|
|
4
|
+
import { nodeRules } from "./node.js";
|
|
5
|
+
import { stylisticRules } from "./stylistic.js";
|
|
6
|
+
import tseslint from "typescript-eslint";
|
|
7
|
+
import vueParser from "vue-eslint-parser";
|
|
8
|
+
import stylisticPlugin from "@stylistic/eslint-plugin";
|
|
9
|
+
import importPlugin from "eslint-plugin-import-x";
|
|
10
|
+
import nodePlugin from "eslint-plugin-n";
|
|
11
|
+
import globals from "globals";
|
|
12
|
+
|
|
13
|
+
//#region src/index.ts
|
|
14
|
+
const GLOB_EXCLUDE = [
|
|
15
|
+
"**/.nx/**",
|
|
16
|
+
"**/.svelte-kit/**",
|
|
17
|
+
"**/build/**",
|
|
18
|
+
"**/coverage/**",
|
|
19
|
+
"**/dist/**",
|
|
20
|
+
"**/snap/**",
|
|
21
|
+
"**/vite.config.*.timestamp-*.*"
|
|
22
|
+
];
|
|
23
|
+
const jsRules = {
|
|
24
|
+
...javascriptRules,
|
|
25
|
+
...typescriptRules,
|
|
26
|
+
...importRules,
|
|
27
|
+
...nodeRules,
|
|
28
|
+
...stylisticRules
|
|
29
|
+
};
|
|
30
|
+
const jsPlugins = {
|
|
31
|
+
"@stylistic": stylisticPlugin,
|
|
32
|
+
"@typescript-eslint": tseslint.plugin,
|
|
33
|
+
import: importPlugin,
|
|
34
|
+
node: nodePlugin
|
|
35
|
+
};
|
|
36
|
+
const tanstackConfig = [
|
|
37
|
+
{
|
|
38
|
+
name: "tanstack/ignores",
|
|
39
|
+
ignores: GLOB_EXCLUDE
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "tanstack/javascript",
|
|
43
|
+
files: ["**/*.{js,ts,tsx}"],
|
|
44
|
+
languageOptions: {
|
|
45
|
+
sourceType: "module",
|
|
46
|
+
ecmaVersion: 2020,
|
|
47
|
+
parser: tseslint.parser,
|
|
48
|
+
parserOptions: {
|
|
49
|
+
project: true,
|
|
50
|
+
parser: tseslint.parser
|
|
51
|
+
},
|
|
52
|
+
globals: { ...globals.browser }
|
|
53
|
+
},
|
|
54
|
+
plugins: jsPlugins,
|
|
55
|
+
rules: jsRules
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "tanstack/vue",
|
|
59
|
+
files: ["**/*.vue"],
|
|
60
|
+
languageOptions: {
|
|
61
|
+
parser: vueParser,
|
|
62
|
+
parserOptions: {
|
|
63
|
+
sourceType: "module",
|
|
64
|
+
ecmaVersion: 2020,
|
|
65
|
+
parser: tseslint.parser,
|
|
66
|
+
project: true,
|
|
67
|
+
extraFileExtensions: [".vue"]
|
|
68
|
+
},
|
|
69
|
+
globals: { ...globals.browser }
|
|
70
|
+
},
|
|
71
|
+
plugins: jsPlugins,
|
|
72
|
+
rules: jsRules
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { tanstackConfig };
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["tanstackConfig: Array<Linter.Config>"],"sources":["../src/index.ts"],"sourcesContent":["import tseslint from 'typescript-eslint'\nimport vueParser from 'vue-eslint-parser'\nimport stylisticPlugin from '@stylistic/eslint-plugin'\nimport importPlugin from 'eslint-plugin-import-x'\nimport nodePlugin from 'eslint-plugin-n'\nimport globals from 'globals'\nimport { javascriptRules } from './javascript.js'\nimport { importRules } from './import.js'\nimport { typescriptRules } from './typescript.js'\nimport { nodeRules } from './node.js'\nimport { stylisticRules } from './stylistic.js'\nimport type { Linter } from 'eslint'\n\nconst GLOB_EXCLUDE = [\n '**/.nx/**',\n '**/.svelte-kit/**',\n '**/build/**',\n '**/coverage/**',\n '**/dist/**',\n '**/snap/**',\n '**/vite.config.*.timestamp-*.*',\n]\n\nconst jsRules = {\n ...javascriptRules,\n ...typescriptRules,\n ...importRules,\n ...nodeRules,\n ...stylisticRules,\n}\n\nconst jsPlugins = {\n '@stylistic': stylisticPlugin,\n '@typescript-eslint': tseslint.plugin,\n import: importPlugin,\n node: nodePlugin,\n}\n\nexport const tanstackConfig: Array<Linter.Config> = [\n {\n name: 'tanstack/ignores',\n ignores: GLOB_EXCLUDE,\n },\n {\n name: 'tanstack/javascript',\n files: ['**/*.{js,ts,tsx}'],\n languageOptions: {\n sourceType: 'module',\n ecmaVersion: 2020,\n parser: tseslint.parser,\n parserOptions: {\n project: true,\n parser: tseslint.parser,\n },\n globals: {\n ...globals.browser,\n },\n },\n // @ts-expect-error\n plugins: jsPlugins,\n rules: jsRules,\n },\n {\n name: 'tanstack/vue',\n files: ['**/*.vue'],\n languageOptions: {\n parser: vueParser,\n parserOptions: {\n sourceType: 'module',\n ecmaVersion: 2020,\n parser: tseslint.parser,\n project: true,\n extraFileExtensions: ['.vue'],\n },\n globals: {\n ...globals.browser,\n },\n },\n // @ts-expect-error\n plugins: jsPlugins,\n rules: jsRules,\n },\n]\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,eAAe;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,UAAU;CACd,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACJ;AAED,MAAM,YAAY;CAChB,cAAc;CACd,sBAAsB,SAAS;CAC/B,QAAQ;CACR,MAAM;CACP;AAED,MAAaA,iBAAuC;CAClD;EACE,MAAM;EACN,SAAS;EACV;CACD;EACE,MAAM;EACN,OAAO,CAAC,mBAAmB;EAC3B,iBAAiB;GACf,YAAY;GACZ,aAAa;GACb,QAAQ,SAAS;GACjB,eAAe;IACb,SAAS;IACT,QAAQ,SAAS;IAClB;GACD,SAAS,EACP,GAAG,QAAQ,SACZ;GACF;EAED,SAAS;EACT,OAAO;EACR;CACD;EACE,MAAM;EACN,OAAO,CAAC,WAAW;EACnB,iBAAiB;GACf,QAAQ;GACR,eAAe;IACb,YAAY;IACZ,aAAa;IACb,QAAQ,SAAS;IACjB,SAAS;IACT,qBAAqB,CAAC,OAAO;IAC9B;GACD,SAAS,EACP,GAAG,QAAQ,SACZ;GACF;EAED,SAAS;EACT,OAAO;EACR;CACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/javascript.ts
|
|
2
|
+
/**
|
|
3
|
+
* @see https://eslint.org/docs/latest/rules/
|
|
4
|
+
*/
|
|
5
|
+
const javascriptRules = {
|
|
6
|
+
"for-direction": "error",
|
|
7
|
+
"no-async-promise-executor": "error",
|
|
8
|
+
"no-case-declarations": "error",
|
|
9
|
+
"no-class-assign": "error",
|
|
10
|
+
"no-compare-neg-zero": "error",
|
|
11
|
+
"no-cond-assign": "error",
|
|
12
|
+
"no-constant-binary-expression": "error",
|
|
13
|
+
"no-constant-condition": "error",
|
|
14
|
+
"no-control-regex": "error",
|
|
15
|
+
"no-debugger": "error",
|
|
16
|
+
"no-delete-var": "error",
|
|
17
|
+
"no-dupe-else-if": "error",
|
|
18
|
+
"no-duplicate-case": "error",
|
|
19
|
+
"no-empty-character-class": "error",
|
|
20
|
+
"no-empty-pattern": "error",
|
|
21
|
+
"no-empty-static-block": "error",
|
|
22
|
+
"no-ex-assign": "error",
|
|
23
|
+
"no-extra-boolean-cast": "error",
|
|
24
|
+
"no-fallthrough": "error",
|
|
25
|
+
"no-global-assign": "error",
|
|
26
|
+
"no-invalid-regexp": "error",
|
|
27
|
+
"no-irregular-whitespace": "error",
|
|
28
|
+
"no-loss-of-precision": "error",
|
|
29
|
+
"no-misleading-character-class": "error",
|
|
30
|
+
"no-nonoctal-decimal-escape": "error",
|
|
31
|
+
"no-octal": "error",
|
|
32
|
+
"no-regex-spaces": "error",
|
|
33
|
+
"no-self-assign": "error",
|
|
34
|
+
"no-shadow": "warn",
|
|
35
|
+
"no-shadow-restricted-names": "error",
|
|
36
|
+
"no-sparse-arrays": "error",
|
|
37
|
+
"no-unsafe-finally": "error",
|
|
38
|
+
"no-unsafe-optional-chaining": "error",
|
|
39
|
+
"no-unused-labels": "error",
|
|
40
|
+
"no-unused-private-class-members": "error",
|
|
41
|
+
"no-useless-backreference": "error",
|
|
42
|
+
"no-useless-catch": "error",
|
|
43
|
+
"no-useless-escape": "error",
|
|
44
|
+
"no-var": "error",
|
|
45
|
+
"no-with": "error",
|
|
46
|
+
"prefer-const": "error",
|
|
47
|
+
"require-yield": "error",
|
|
48
|
+
"sort-imports": ["error", { ignoreDeclarationSort: true }],
|
|
49
|
+
"use-isnan": "error",
|
|
50
|
+
"valid-typeof": "error"
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { javascriptRules };
|
|
55
|
+
//# sourceMappingURL=javascript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"javascript.js","names":["javascriptRules: Linter.RulesRecord"],"sources":["../src/javascript.ts"],"sourcesContent":["import type { Linter } from 'eslint'\n\n/**\n * @see https://eslint.org/docs/latest/rules/\n */\nexport const javascriptRules: Linter.RulesRecord = {\n /** TODO */\n 'for-direction': 'error',\n 'no-async-promise-executor': 'error',\n 'no-case-declarations': 'error',\n 'no-class-assign': 'error',\n 'no-compare-neg-zero': 'error',\n 'no-cond-assign': 'error',\n 'no-constant-binary-expression': 'error',\n 'no-constant-condition': 'error',\n 'no-control-regex': 'error',\n 'no-debugger': 'error',\n 'no-delete-var': 'error',\n 'no-dupe-else-if': 'error',\n 'no-duplicate-case': 'error',\n 'no-empty-character-class': 'error',\n 'no-empty-pattern': 'error',\n 'no-empty-static-block': 'error',\n 'no-ex-assign': 'error',\n 'no-extra-boolean-cast': 'error',\n 'no-fallthrough': 'error',\n 'no-global-assign': 'error',\n 'no-invalid-regexp': 'error',\n 'no-irregular-whitespace': 'error',\n 'no-loss-of-precision': 'error',\n 'no-misleading-character-class': 'error',\n 'no-nonoctal-decimal-escape': 'error',\n 'no-octal': 'error',\n 'no-regex-spaces': 'error',\n 'no-self-assign': 'error',\n /** Warn about variable with identical names in the outer scope */\n 'no-shadow': 'warn',\n 'no-shadow-restricted-names': 'error',\n 'no-sparse-arrays': 'error',\n 'no-unsafe-finally': 'error',\n 'no-unsafe-optional-chaining': 'error',\n 'no-unused-labels': 'error',\n 'no-unused-private-class-members': 'error',\n 'no-useless-backreference': 'error',\n 'no-useless-catch': 'error',\n 'no-useless-escape': 'error',\n /** Prefer let and const */\n 'no-var': 'error',\n 'no-with': 'error',\n /** Prefer const if never re-assigned */\n 'prefer-const': 'error',\n 'require-yield': 'error',\n /** Stylistic consistency */\n 'sort-imports': ['error', { ignoreDeclarationSort: true }],\n 'use-isnan': 'error',\n /** Enforce comparing typeof against valid strings */\n 'valid-typeof': 'error',\n}\n"],"mappings":";;;;AAKA,MAAaA,kBAAsC;CAEjD,iBAAiB;CACjB,6BAA6B;CAC7B,wBAAwB;CACxB,mBAAmB;CACnB,uBAAuB;CACvB,kBAAkB;CAClB,iCAAiC;CACjC,yBAAyB;CACzB,oBAAoB;CACpB,eAAe;CACf,iBAAiB;CACjB,mBAAmB;CACnB,qBAAqB;CACrB,4BAA4B;CAC5B,oBAAoB;CACpB,yBAAyB;CACzB,gBAAgB;CAChB,yBAAyB;CACzB,kBAAkB;CAClB,oBAAoB;CACpB,qBAAqB;CACrB,2BAA2B;CAC3B,wBAAwB;CACxB,iCAAiC;CACjC,8BAA8B;CAC9B,YAAY;CACZ,mBAAmB;CACnB,kBAAkB;CAElB,aAAa;CACb,8BAA8B;CAC9B,oBAAoB;CACpB,qBAAqB;CACrB,+BAA+B;CAC/B,oBAAoB;CACpB,mCAAmC;CACnC,4BAA4B;CAC5B,oBAAoB;CACpB,qBAAqB;CAErB,UAAU;CACV,WAAW;CAEX,gBAAgB;CAChB,iBAAiB;CAEjB,gBAAgB,CAAC,SAAS,EAAE,uBAAuB,MAAM,CAAC;CAC1D,aAAa;CAEb,gBAAgB;CACjB"}
|
package/dist/node.js
ADDED
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","names":["nodeRules: Linter.RulesRecord"],"sources":["../src/node.ts"],"sourcesContent":["import type { Linter } from 'eslint'\n\n/**\n * @see https://github.com/eslint-community/eslint-plugin-n\n */\nexport const nodeRules: Linter.RulesRecord = {\n /** Enforce usage of the `node:` prefix for builtin imports */\n 'node/prefer-node-protocol': 'error',\n}\n"],"mappings":";;;;AAKA,MAAaA,YAAgC,EAE3C,6BAA6B,SAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stylistic.js","names":["stylisticRules: Linter.RulesRecord"],"sources":["../src/stylistic.ts"],"sourcesContent":["import type { Linter } from 'eslint'\n\n/**\n * @see https://eslint.style/packages/js\n */\nexport const stylisticRules: Linter.RulesRecord = {\n /** Enforce consistency of spacing after the start of a comment */\n '@stylistic/spaced-comment': 'error',\n}\n"],"mappings":";;;;AAKA,MAAaA,iBAAqC,EAEhD,6BAA6B,SAC9B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/typescript.ts
|
|
2
|
+
/**
|
|
3
|
+
* @see https://typescript-eslint.io/rules/
|
|
4
|
+
*/
|
|
5
|
+
const typescriptRules = {
|
|
6
|
+
"@typescript-eslint/array-type": ["error", {
|
|
7
|
+
default: "generic",
|
|
8
|
+
readonly: "generic"
|
|
9
|
+
}],
|
|
10
|
+
"@typescript-eslint/ban-ts-comment": ["error", {
|
|
11
|
+
"ts-expect-error": false,
|
|
12
|
+
"ts-ignore": "allow-with-description"
|
|
13
|
+
}],
|
|
14
|
+
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports" }],
|
|
15
|
+
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
16
|
+
"@typescript-eslint/naming-convention": ["error", {
|
|
17
|
+
selector: "typeParameter",
|
|
18
|
+
format: ["PascalCase"],
|
|
19
|
+
leadingUnderscore: "forbid",
|
|
20
|
+
trailingUnderscore: "forbid",
|
|
21
|
+
custom: {
|
|
22
|
+
regex: "^(T|T[A-Z][A-Za-z]+)$",
|
|
23
|
+
match: true
|
|
24
|
+
}
|
|
25
|
+
}],
|
|
26
|
+
"@typescript-eslint/no-duplicate-enum-values": "error",
|
|
27
|
+
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
28
|
+
"@typescript-eslint/no-for-in-array": "error",
|
|
29
|
+
"@typescript-eslint/no-inferrable-types": ["error", { ignoreParameters: true }],
|
|
30
|
+
"@typescript-eslint/no-misused-new": "error",
|
|
31
|
+
"@typescript-eslint/no-namespace": "error",
|
|
32
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
33
|
+
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
34
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
35
|
+
"@typescript-eslint/no-unsafe-function-type": "error",
|
|
36
|
+
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
37
|
+
"@typescript-eslint/prefer-as-const": "error",
|
|
38
|
+
"@typescript-eslint/prefer-for-of": "warn",
|
|
39
|
+
"@typescript-eslint/require-await": "warn",
|
|
40
|
+
"@typescript-eslint/triple-slash-reference": "error"
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
//#endregion
|
|
44
|
+
export { typescriptRules };
|
|
45
|
+
//# sourceMappingURL=typescript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","names":["typescriptRules: Linter.RulesRecord"],"sources":["../src/typescript.ts"],"sourcesContent":["import type { Linter } from 'eslint'\n\n/**\n * @see https://typescript-eslint.io/rules/\n */\nexport const typescriptRules: Linter.RulesRecord = {\n /** Prefer Array<T> format */\n '@typescript-eslint/array-type': [\n 'error',\n { default: 'generic', readonly: 'generic' },\n ],\n /** Prevent @ts-ignore, allow @ts-expect-error */\n '@typescript-eslint/ban-ts-comment': [\n 'error',\n {\n 'ts-expect-error': false,\n 'ts-ignore': 'allow-with-description',\n },\n ],\n /** Enforce import type { T } */\n '@typescript-eslint/consistent-type-imports': [\n 'error',\n { prefer: 'type-imports' },\n ],\n /** Shorthand method style is less strict */\n '@typescript-eslint/method-signature-style': ['error', 'property'],\n /** Enforces generic type convention */\n '@typescript-eslint/naming-convention': [\n 'error',\n {\n selector: 'typeParameter',\n format: ['PascalCase'],\n leadingUnderscore: 'forbid',\n trailingUnderscore: 'forbid',\n custom: {\n regex: '^(T|T[A-Z][A-Za-z]+)$',\n match: true,\n },\n },\n ],\n /** Duplicate values can lead to bugs that are hard to track down */\n '@typescript-eslint/no-duplicate-enum-values': 'error',\n /** Using the operator any more than once does nothing */\n '@typescript-eslint/no-extra-non-null-assertion': 'error',\n /** There are several potential bugs with this compared to other loops */\n '@typescript-eslint/no-for-in-array': 'error',\n /** Don't over-define types for simple things like strings */\n '@typescript-eslint/no-inferrable-types': [\n 'error',\n { ignoreParameters: true },\n ],\n /** Enforce valid definition of new and constructor */\n '@typescript-eslint/no-misused-new': 'error',\n /** Disallow TypeScript namespaces */\n '@typescript-eslint/no-namespace': 'error',\n /** Disallow non-null assertions after an optional chain expression */\n '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',\n /** Detects conditionals which will always evaluate truthy or falsy */\n '@typescript-eslint/no-unnecessary-condition': 'error',\n /** Checks if the the explicit type is identical to the inferred type */\n '@typescript-eslint/no-unnecessary-type-assertion': 'error',\n /** Disallow using the unsafe built-in Function type */\n '@typescript-eslint/no-unsafe-function-type': 'error',\n /** Disallow using confusing built-in primitive class wrappers */\n '@typescript-eslint/no-wrapper-object-types': 'error',\n /** Enforce the use of as const over literal type */\n '@typescript-eslint/prefer-as-const': 'error',\n /** Prefer for-of loop over the standard for loop */\n '@typescript-eslint/prefer-for-of': 'warn',\n /** Warn about async functions which have no await expression */\n '@typescript-eslint/require-await': 'warn',\n /** Prefer of ES6-style import declarations */\n '@typescript-eslint/triple-slash-reference': 'error',\n}\n"],"mappings":";;;;AAKA,MAAaA,kBAAsC;CAEjD,iCAAiC,CAC/B,SACA;EAAE,SAAS;EAAW,UAAU;EAAW,CAC5C;CAED,qCAAqC,CACnC,SACA;EACE,mBAAmB;EACnB,aAAa;EACd,CACF;CAED,8CAA8C,CAC5C,SACA,EAAE,QAAQ,gBAAgB,CAC3B;CAED,6CAA6C,CAAC,SAAS,WAAW;CAElE,wCAAwC,CACtC,SACA;EACE,UAAU;EACV,QAAQ,CAAC,aAAa;EACtB,mBAAmB;EACnB,oBAAoB;EACpB,QAAQ;GACN,OAAO;GACP,OAAO;GACR;EACF,CACF;CAED,+CAA+C;CAE/C,kDAAkD;CAElD,sCAAsC;CAEtC,0CAA0C,CACxC,SACA,EAAE,kBAAkB,MAAM,CAC3B;CAED,qCAAqC;CAErC,mCAAmC;CAEnC,0DAA0D;CAE1D,+CAA+C;CAE/C,oDAAoD;CAEpD,8CAA8C;CAE9C,8CAA8C;CAE9C,sCAAsC;CAEtC,oCAAoC;CAEpC,oCAAoC;CAEpC,6CAA6C;CAC9C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/eslint-config",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "Shared ESLint config used by TanStack projects.",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,38 +15,42 @@
|
|
|
15
15
|
"url": "https://github.com/sponsors/tannerlinsley"
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"module": "./dist/index.js",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
18
21
|
"exports": {
|
|
19
|
-
".":
|
|
20
|
-
"import": {
|
|
21
|
-
"default": "./src/index.js"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
22
|
+
".": "./dist/index.js",
|
|
24
23
|
"./package.json": "./package.json"
|
|
25
24
|
},
|
|
26
25
|
"preferGlobal": false,
|
|
27
26
|
"sideEffects": false,
|
|
28
27
|
"files": [
|
|
28
|
+
"dist",
|
|
29
29
|
"src"
|
|
30
30
|
],
|
|
31
31
|
"engines": {
|
|
32
32
|
"node": ">=18"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@eslint/js": "^9.
|
|
35
|
+
"@eslint/js": "^9.37.0",
|
|
36
36
|
"@stylistic/eslint-plugin": "^5.4.0",
|
|
37
37
|
"eslint-plugin-import-x": "^4.16.1",
|
|
38
38
|
"eslint-plugin-n": "^17.23.1",
|
|
39
|
-
"globals": "^16.
|
|
40
|
-
"typescript-eslint": "^8.
|
|
39
|
+
"globals": "^16.5.0",
|
|
40
|
+
"typescript-eslint": "^8.46.0",
|
|
41
41
|
"vue-eslint-parser": "^10.2.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/eslint": "^9.6.1",
|
|
45
|
-
"eslint": "^9.
|
|
45
|
+
"eslint": "^9.37.0",
|
|
46
|
+
"tsdown": "^0.17.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"eslint": "^8.0.0 || ^9.0.0"
|
|
46
50
|
},
|
|
47
51
|
"scripts": {
|
|
48
52
|
"test:types": "tsc",
|
|
49
53
|
"test:eslint": "eslint --concurrency=auto ./src",
|
|
50
|
-
"
|
|
54
|
+
"build": "tsdown"
|
|
51
55
|
}
|
|
52
56
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Linter } from 'eslint'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @see https://github.com/un-ts/eslint-plugin-import-x
|
|
5
|
+
*/
|
|
6
|
+
export const importRules: Linter.RulesRecord = {
|
|
5
7
|
/** Bans the use of inline type-only markers for named imports */
|
|
6
8
|
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
|
|
7
9
|
/** Reports any imports that come after non-import statements */
|
|
@@ -9,6 +9,7 @@ import { importRules } from './import.js'
|
|
|
9
9
|
import { typescriptRules } from './typescript.js'
|
|
10
10
|
import { nodeRules } from './node.js'
|
|
11
11
|
import { stylisticRules } from './stylistic.js'
|
|
12
|
+
import type { Linter } from 'eslint'
|
|
12
13
|
|
|
13
14
|
const GLOB_EXCLUDE = [
|
|
14
15
|
'**/.nx/**',
|
|
@@ -35,8 +36,7 @@ const jsPlugins = {
|
|
|
35
36
|
node: nodePlugin,
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
export const tanstackConfig = [
|
|
39
|
+
export const tanstackConfig: Array<Linter.Config> = [
|
|
40
40
|
{
|
|
41
41
|
name: 'tanstack/ignores',
|
|
42
42
|
ignores: GLOB_EXCLUDE,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Linter } from 'eslint'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @see https://eslint.org/docs/latest/rules/
|
|
5
|
+
*/
|
|
6
|
+
export const javascriptRules: Linter.RulesRecord = {
|
|
5
7
|
/** TODO */
|
|
6
8
|
'for-direction': 'error',
|
|
7
9
|
'no-async-promise-executor': 'error',
|
package/src/node.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Linter } from 'eslint'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @see https://github.com/eslint-community/eslint-plugin-n
|
|
5
|
+
*/
|
|
6
|
+
export const nodeRules: Linter.RulesRecord = {
|
|
7
|
+
/** Enforce usage of the `node:` prefix for builtin imports */
|
|
8
|
+
'node/prefer-node-protocol': 'error',
|
|
9
|
+
}
|
package/src/stylistic.ts
ADDED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Linter } from 'eslint'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @see https://typescript-eslint.io/rules/
|
|
5
|
+
*/
|
|
6
|
+
export const typescriptRules: Linter.RulesRecord = {
|
|
5
7
|
/** Prefer Array<T> format */
|
|
6
8
|
'@typescript-eslint/array-type': [
|
|
7
9
|
'error',
|
package/src/node.js
DELETED
package/src/stylistic.js
DELETED