Skip to content

Commit 64d07f8

Browse files
committed
chore: integrate nadle configs
1 parent c150a03 commit 64d07f8

File tree

8 files changed

+268
-317
lines changed

8 files changed

+268
-317
lines changed

eslint.config.ts

Lines changed: 7 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
import eslint from "@eslint/js";
2-
import nPlugin from "eslint-plugin-n";
3-
import tsEslint from "typescript-eslint";
4-
import vitest from "@vitest/eslint-plugin";
5-
import stylistic from "@stylistic/eslint-plugin";
6-
import perfectionist from "eslint-plugin-perfectionist";
7-
import unusedImports from "eslint-plugin-unused-imports";
1+
import nadle from "@nadle/eslint-config";
2+
import tsEslint, { type ConfigArray } from "typescript-eslint";
83

9-
export default tsEslint.config(
10-
eslint.configs.recommended,
11-
tsEslint.configs.recommended,
12-
nPlugin.configs["flat/recommended-module"],
4+
const config: ConfigArray = tsEslint.config(
5+
...nadle.configs.recommended,
6+
nadle.configs.react,
137
{
148
ignores: [
159
"**/lib",
@@ -22,104 +16,12 @@ export default tsEslint.config(
2216
]
2317
},
2418
{
25-
linterOptions: {
26-
reportUnusedDisableDirectives: "error"
27-
},
28-
plugins: {
29-
stylistic,
30-
perfectionist,
31-
unusedImports
32-
},
3319
languageOptions: {
3420
parserOptions: {
3521
project: ["**/tsconfig.eslint.json"]
3622
}
37-
},
38-
rules: {
39-
curly: "error",
40-
"sort-keys": "off",
41-
"no-console": "warn",
42-
"max-params": ["error", 4],
43-
"no-restricted-imports": ["error", { patterns: ["consola"] }],
44-
45-
"n/hashbang": "off",
46-
"n/no-missing-import": "off",
47-
"n/no-unpublished-import": "off",
48-
"n/prefer-node-protocol": "error",
49-
"n/no-unsupported-features/node-builtins": "off",
50-
51-
"unusedImports/no-unused-imports": "error",
52-
53-
"@typescript-eslint/no-namespace": "off",
54-
"@typescript-eslint/no-explicit-any": "warn",
55-
"@typescript-eslint/no-empty-object-type": "off",
56-
"@typescript-eslint/explicit-member-accessibility": "error",
57-
"@typescript-eslint/consistent-type-imports": ["error", { prefer: "type-imports", fixStyle: "inline-type-imports" }],
58-
"@typescript-eslint/no-unused-vars": [
59-
"error",
60-
{ argsIgnorePattern: "^_", ignoreRestSiblings: true, destructuredArrayIgnorePattern: "^_", caughtErrorsIgnorePattern: "^error$" }
61-
],
62-
63-
"perfectionist/sort-named-imports": ["error", { type: "line-length" }],
64-
"perfectionist/sort-objects": ["error", { type: "line-length", partitionByNewLine: true }],
65-
"perfectionist/sort-exports": ["error", { type: "line-length", partitionByNewLine: true }],
66-
"perfectionist/sort-interfaces": ["error", { type: "line-length", partitionByNewLine: true }],
67-
"perfectionist/sort-object-types": ["error", { type: "line-length", partitionByNewLine: true }],
68-
"perfectionist/sort-imports": [
69-
"error",
70-
{ type: "line-length", newlinesBetween: "always", groups: ["side-effect", "builtin", "external", ["parent", "sibling", "index"]] }
71-
],
72-
73-
"stylistic/padding-line-between-statements": [
74-
"error",
75-
{ prev: "*", blankLine: "always", next: ["if", "while", "for", "switch", "try", "do", "return"] },
76-
{ next: "*", prev: "block-like", blankLine: "always" }
77-
]
78-
}
79-
},
80-
{
81-
files: ["packages/nadle/src/**"],
82-
rules: {
83-
"no-restricted-properties": [
84-
"error",
85-
{
86-
property: "cwd",
87-
object: "process",
88-
message: "Avoid using process.cwd()"
89-
},
90-
{
91-
property: "cwd",
92-
object: "Process",
93-
message: "Avoid using Process.cwd()"
94-
}
95-
]
96-
}
97-
},
98-
{
99-
rules: {
100-
"no-console": "off"
101-
},
102-
files: ["packages/sample-app/**", "packages/nadle/test/**", "packages/validators/**", "packages/examples/**"]
103-
},
104-
{
105-
files: ["packages/nadle/test/fixtures/**"],
106-
rules: {
107-
"no-restricted-imports": ["error", { patterns: ["../**/src/*"] }]
108-
}
109-
},
110-
{
111-
plugins: {
112-
vitest
113-
},
114-
files: ["**/test/**/*.test.ts"],
115-
rules: {
116-
...vitest.configs.recommended.rules,
117-
"vitest/expect-expect": [
118-
"error",
119-
{
120-
assertFunctionNames: ["expectPass", "expectFail", "expect"]
121-
}
122-
]
12323
}
12424
}
12525
);
26+
27+
export default config;

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@
99
"devDependencies": {
1010
"@eslint/js": "^9.29.0",
1111
"@microsoft/api-extractor": "^7.52.8",
12-
"@stylistic/eslint-plugin": "^5.0.0",
13-
"@vitest/eslint-plugin": "^1.3.3",
12+
"@nadle/eslint-config": "^1.0.0",
13+
"@nadle/prettier-config": "^0.0.5",
14+
"@nadle/ts-config": "^0.0.2",
1415
"cspell": "^9.1.2",
1516
"eslint": "^9.29.0",
16-
"eslint-plugin-import": "^2.32.0",
17-
"eslint-plugin-n": "^17.20.0",
18-
"eslint-plugin-perfectionist": "^4.15.0",
19-
"eslint-plugin-unused-imports": "^4.1.4",
2017
"husky": "^9.1.7",
2118
"jiti": "^2.4.2",
2219
"lint-staged": "^16.1.2",
@@ -30,6 +27,7 @@
3027
"node": ">=20"
3128
},
3229
"packageManager": "pnpm@9.15.1+sha512.1acb565e6193efbebda772702950469150cf12bcc764262e7587e71d19dc98a423dff9536e57ea44c49bdf790ff694e83c27be5faa23d67e0c033b583be4bfcf",
30+
"prettier": "@nadle/prettier-config",
3331
"lint-staged": {
3432
"*": "cspell --no-must-find-files --gitignore",
3533
"*.ts": "eslint --fix",

0 commit comments

Comments
 (0)