@kyh/eslint-config 0.1.9 → 1.0.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.
- package/CHANGELOG.md +61 -0
- package/base.js +62 -60
- package/nextjs.js +23 -16
- package/package.json +19 -26
- package/react.js +26 -28
- package/tsconfig.json +5 -0
- package/types.d.ts +67 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @kyh/eslint-config
|
|
2
|
+
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- update to eslint 9
|
|
8
|
+
|
|
9
|
+
## 0.1.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- update packages
|
|
14
|
+
|
|
15
|
+
## 0.1.8
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- update tsconfig
|
|
20
|
+
|
|
21
|
+
## 0.1.7
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- update packages, split up tsconfig
|
|
26
|
+
|
|
27
|
+
## 0.1.6
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- update packages, allow usage in non monorepos
|
|
32
|
+
|
|
33
|
+
## 0.1.5
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- update packages
|
|
38
|
+
|
|
39
|
+
## 0.1.4
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- update deps
|
|
44
|
+
|
|
45
|
+
## 0.1.3
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- remove hardcoded prettier import name
|
|
50
|
+
|
|
51
|
+
## 0.1.2
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- update prettier path
|
|
56
|
+
|
|
57
|
+
## 0.1.1
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- bump to latest
|
package/base.js
CHANGED
|
@@ -1,62 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
],
|
|
26
|
-
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
27
|
-
"@typescript-eslint/consistent-type-definitions": ["warn", "type"],
|
|
28
|
-
"@typescript-eslint/no-misused-promises": [
|
|
29
|
-
"error",
|
|
30
|
-
{
|
|
31
|
-
checksVoidReturn: false,
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
"@typescript-eslint/no-unnecessary-condition": [
|
|
35
|
-
"error",
|
|
36
|
-
{
|
|
37
|
-
allowConstantLoopConditions: true,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
"@typescript-eslint/no-non-null-assertion": "error",
|
|
41
|
-
"prefer-arrow-functions/prefer-arrow-functions": [
|
|
42
|
-
"warn",
|
|
43
|
-
{
|
|
44
|
-
classPropertiesAllowed: false,
|
|
45
|
-
disallowPrototype: false,
|
|
46
|
-
returnStyle: "unchanged",
|
|
47
|
-
singleReturnOnly: false,
|
|
48
|
-
},
|
|
1
|
+
/// <reference types="./types.d.ts" />
|
|
2
|
+
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { includeIgnoreFile } from "@eslint/compat";
|
|
5
|
+
import eslint from "@eslint/js";
|
|
6
|
+
import importPlugin from "eslint-plugin-import";
|
|
7
|
+
import turboPlugin from "eslint-plugin-turbo";
|
|
8
|
+
import tseslint from "typescript-eslint";
|
|
9
|
+
|
|
10
|
+
export default tseslint.config(
|
|
11
|
+
// Ignore files not tracked by VCS and any config files
|
|
12
|
+
includeIgnoreFile(path.join(import.meta.dirname, "../../.gitignore")),
|
|
13
|
+
{ ignores: ["**/*.config.*"] },
|
|
14
|
+
{
|
|
15
|
+
files: ["**/*.js", "**/*.ts", "**/*.tsx"],
|
|
16
|
+
plugins: {
|
|
17
|
+
import: importPlugin,
|
|
18
|
+
turbo: turboPlugin,
|
|
19
|
+
},
|
|
20
|
+
extends: [
|
|
21
|
+
eslint.configs.recommended,
|
|
22
|
+
...tseslint.configs.recommended,
|
|
23
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
24
|
+
...tseslint.configs.stylisticTypeChecked,
|
|
49
25
|
],
|
|
26
|
+
rules: {
|
|
27
|
+
...turboPlugin.configs.recommended.rules,
|
|
28
|
+
"@typescript-eslint/no-unused-vars": [
|
|
29
|
+
"error",
|
|
30
|
+
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
|
|
31
|
+
],
|
|
32
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
33
|
+
"warn",
|
|
34
|
+
{ prefer: "type-imports", fixStyle: "separate-type-imports" },
|
|
35
|
+
],
|
|
36
|
+
"@typescript-eslint/no-misused-promises": [
|
|
37
|
+
2,
|
|
38
|
+
{ checksVoidReturn: { attributes: false } },
|
|
39
|
+
],
|
|
40
|
+
"@typescript-eslint/no-unnecessary-condition": [
|
|
41
|
+
"error",
|
|
42
|
+
{
|
|
43
|
+
allowConstantLoopConditions: true,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
"@typescript-eslint/no-non-null-assertion": "error",
|
|
47
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
48
|
+
// "prefer-arrow-functions/prefer-arrow-functions": [
|
|
49
|
+
// "warn",
|
|
50
|
+
// {
|
|
51
|
+
// classPropertiesAllowed: false,
|
|
52
|
+
// disallowPrototype: false,
|
|
53
|
+
// returnStyle: "unchanged",
|
|
54
|
+
// singleReturnOnly: false,
|
|
55
|
+
// },
|
|
56
|
+
// ],
|
|
57
|
+
"@typescript-eslint/consistent-type-definitions": ["warn", "type"],
|
|
58
|
+
},
|
|
50
59
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"dist",
|
|
57
|
-
"pnpm-lock.yaml",
|
|
58
|
-
],
|
|
59
|
-
reportUnusedDisableDirectives: true,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
module.exports = config;
|
|
60
|
+
{
|
|
61
|
+
linterOptions: { reportUnusedDisableDirectives: true },
|
|
62
|
+
languageOptions: { parserOptions: { projectService: true } },
|
|
63
|
+
},
|
|
64
|
+
);
|
package/nextjs.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
const config = {
|
|
3
|
-
extends: ["plugin:@next/next/core-web-vitals"],
|
|
4
|
-
rules: {
|
|
5
|
-
"@next/next/no-html-link-for-pages": "off",
|
|
6
|
-
"@typescript-eslint/require-await": "off",
|
|
7
|
-
"react/function-component-definition": [
|
|
8
|
-
"warn",
|
|
9
|
-
{
|
|
10
|
-
namedComponents: "arrow-function",
|
|
11
|
-
unnamedComponents: "arrow-function",
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
},
|
|
15
|
-
};
|
|
1
|
+
import nextPlugin from "@next/eslint-plugin-next";
|
|
16
2
|
|
|
17
|
-
|
|
3
|
+
/** @type {Awaited<import('typescript-eslint').Config>} */
|
|
4
|
+
export default [
|
|
5
|
+
{
|
|
6
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
7
|
+
plugins: {
|
|
8
|
+
"@next/next": nextPlugin,
|
|
9
|
+
},
|
|
10
|
+
rules: {
|
|
11
|
+
...nextPlugin.configs.recommended.rules,
|
|
12
|
+
...nextPlugin.configs["core-web-vitals"].rules,
|
|
13
|
+
// TypeError: context.getAncestors is not a function
|
|
14
|
+
"@next/next/no-duplicate-head": "off",
|
|
15
|
+
"react/function-component-definition": [
|
|
16
|
+
"warn",
|
|
17
|
+
{
|
|
18
|
+
namedComponents: "arrow-function",
|
|
19
|
+
unnamedComponents: "arrow-function",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
];
|
package/package.json
CHANGED
|
@@ -1,44 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kyh/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"./
|
|
10
|
-
"./
|
|
11
|
-
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./base": "./base.js",
|
|
10
|
+
"./nextjs": "./nextjs.js",
|
|
11
|
+
"./react": "./react.js"
|
|
12
|
+
},
|
|
12
13
|
"dependencies": {
|
|
13
|
-
"@
|
|
14
|
-
"@
|
|
15
|
-
"@typescript-eslint/parser": "^7.14.1",
|
|
16
|
-
"eslint-config-turbo": "^2.0.5",
|
|
14
|
+
"@eslint/compat": "^1.1.1",
|
|
15
|
+
"@next/eslint-plugin-next": "^14.2.5",
|
|
17
16
|
"eslint-plugin-import": "^2.29.1",
|
|
18
17
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
19
18
|
"eslint-plugin-prefer-arrow-functions": "^3.3.2",
|
|
20
|
-
"eslint-plugin-react": "^7.
|
|
21
|
-
"eslint-plugin-react-hooks": "
|
|
19
|
+
"eslint-plugin-react": "^7.35.0",
|
|
20
|
+
"eslint-plugin-react-hooks": "rc",
|
|
21
|
+
"eslint-plugin-turbo": "^2.0.12",
|
|
22
|
+
"typescript-eslint": "^8.0.1"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"@kyh/
|
|
29
|
-
"@kyh/tsconfig": "^0.1.9"
|
|
30
|
-
},
|
|
31
|
-
"eslintConfig": {
|
|
32
|
-
"root": true,
|
|
33
|
-
"extends": [
|
|
34
|
-
"./base.js"
|
|
35
|
-
]
|
|
25
|
+
"eslint": "^9.9.0",
|
|
26
|
+
"prettier": "^3.3.3",
|
|
27
|
+
"typescript": "^5.5.4",
|
|
28
|
+
"@kyh/prettier-config": "1.0.0",
|
|
29
|
+
"@kyh/tsconfig": "1.0.0"
|
|
36
30
|
},
|
|
37
31
|
"prettier": "@kyh/prettier-config",
|
|
38
32
|
"scripts": {
|
|
39
|
-
"clean": "
|
|
33
|
+
"clean": "git clean -xdf .cache .nitro .output .turbo .vercel node_modules",
|
|
40
34
|
"format": "prettier --check . --ignore-path ../../.gitignore",
|
|
41
|
-
"lint": "eslint .",
|
|
42
35
|
"typecheck": "tsc --noEmit"
|
|
43
36
|
}
|
|
44
37
|
}
|
package/react.js
CHANGED
|
@@ -1,31 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import reactPlugin from "eslint-plugin-react";
|
|
2
|
+
import hooksPlugin from "eslint-plugin-react-hooks";
|
|
3
|
+
|
|
4
|
+
/** @type {Awaited<import('typescript-eslint').Config>} */
|
|
5
|
+
export default [
|
|
6
|
+
{
|
|
7
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
8
|
+
plugins: {
|
|
9
|
+
react: reactPlugin,
|
|
10
|
+
"react-hooks": hooksPlugin,
|
|
11
|
+
},
|
|
12
|
+
rules: {
|
|
13
|
+
...reactPlugin.configs["jsx-runtime"].rules,
|
|
14
|
+
...hooksPlugin.configs.recommended.rules,
|
|
15
|
+
"react/function-component-definition": [
|
|
16
|
+
"warn",
|
|
17
|
+
{
|
|
18
|
+
namedComponents: "arrow-function",
|
|
19
|
+
unnamedComponents: "arrow-function",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
languageOptions: {
|
|
24
|
+
globals: {
|
|
25
|
+
React: "writable",
|
|
15
26
|
},
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
globals: {
|
|
19
|
-
React: "writable",
|
|
20
|
-
},
|
|
21
|
-
settings: {
|
|
22
|
-
react: {
|
|
23
|
-
version: "detect",
|
|
24
27
|
},
|
|
25
28
|
},
|
|
26
|
-
|
|
27
|
-
browser: true,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
module.exports = config;
|
|
29
|
+
];
|
package/tsconfig.json
ADDED
package/types.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Since the ecosystem hasn't fully migrated to ESLint's new FlatConfig system yet,
|
|
3
|
+
* we "need" to type some of the plugins manually :(
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare module "@eslint/js" {
|
|
7
|
+
// Why the hell doesn't eslint themselves export their types?
|
|
8
|
+
import type { Linter } from "eslint";
|
|
9
|
+
|
|
10
|
+
export const configs: {
|
|
11
|
+
readonly recommended: { readonly rules: Readonly<Linter.RulesRecord> };
|
|
12
|
+
readonly all: { readonly rules: Readonly<Linter.RulesRecord> };
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module "eslint-plugin-import" {
|
|
17
|
+
import type { Linter, Rule } from "eslint";
|
|
18
|
+
|
|
19
|
+
export const configs: {
|
|
20
|
+
recommended: { rules: Linter.RulesRecord };
|
|
21
|
+
};
|
|
22
|
+
export const rules: Record<string, Rule.RuleModule>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare module "eslint-plugin-react" {
|
|
26
|
+
import type { Linter, Rule } from "eslint";
|
|
27
|
+
|
|
28
|
+
export const configs: {
|
|
29
|
+
recommended: { rules: Linter.RulesRecord };
|
|
30
|
+
all: { rules: Linter.RulesRecord };
|
|
31
|
+
"jsx-runtime": { rules: Linter.RulesRecord };
|
|
32
|
+
};
|
|
33
|
+
export const rules: Record<string, Rule.RuleModule>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare module "eslint-plugin-react-hooks" {
|
|
37
|
+
import type { Linter, Rule } from "eslint";
|
|
38
|
+
|
|
39
|
+
export const configs: {
|
|
40
|
+
recommended: {
|
|
41
|
+
rules: {
|
|
42
|
+
"rules-of-hooks": Linter.RuleEntry;
|
|
43
|
+
"exhaustive-deps": Linter.RuleEntry;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export const rules: Record<string, Rule.RuleModule>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare module "@next/eslint-plugin-next" {
|
|
51
|
+
import type { Linter, Rule } from "eslint";
|
|
52
|
+
|
|
53
|
+
export const configs: {
|
|
54
|
+
recommended: { rules: Linter.RulesRecord };
|
|
55
|
+
"core-web-vitals": { rules: Linter.RulesRecord };
|
|
56
|
+
};
|
|
57
|
+
export const rules: Record<string, Rule.RuleModule>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare module "eslint-plugin-turbo" {
|
|
61
|
+
import type { Linter, Rule } from "eslint";
|
|
62
|
+
|
|
63
|
+
export const configs: {
|
|
64
|
+
recommended: { rules: Linter.RulesRecord };
|
|
65
|
+
};
|
|
66
|
+
export const rules: Record<string, Rule.RuleModule>;
|
|
67
|
+
}
|