neatlint 1.0.4 → 1.1.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/README.md +2 -2
- package/dist/defaults/NeatlintOptions.default.js +14 -5
- package/dist/defaults/NeatlintOptions.default.mjs +14 -5
- package/dist/main.js +24 -16
- package/dist/main.mjs +24 -16
- package/dist/types/NeatlintOptions.type.d.mts +15 -10
- package/dist/types/NeatlintOptions.type.d.ts +15 -10
- package/dist/utils/Neatlint.util.js +24 -16
- package/dist/utils/Neatlint.util.mjs +24 -16
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ deno install npm:neatlint
|
|
|
84
84
|
Briefly as follows.
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
87
|
-
|
|
87
|
+
Neatlint
|
|
88
88
|
│
|
|
89
89
|
├── Neatlint(options?)
|
|
90
90
|
│
|
|
@@ -125,7 +125,7 @@ Get the ESLint configuration generated by Neatlint.
|
|
|
125
125
|
|
|
126
126
|
### Recommended use
|
|
127
127
|
|
|
128
|
-
Suggested uses are as follows. We recommend using Prettier.
|
|
128
|
+
Suggested uses are as follows. We recommend using [Prettier](https://npmjs.com/package/prettier).
|
|
129
129
|
|
|
130
130
|
> **📁 ./eslint.config.ts**
|
|
131
131
|
>
|
|
@@ -34,10 +34,11 @@ __export(NeatlintOptions_default_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(NeatlintOptions_default_exports);
|
|
36
36
|
var import_typescript_eslint = __toESM(require("typescript-eslint"));
|
|
37
|
+
var import_js = __toESM(require("@eslint/js"));
|
|
37
38
|
var NeatlintOptionsDefault = {
|
|
38
39
|
ignores: ["./dist/**"],
|
|
39
|
-
|
|
40
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
40
|
+
typescript: {
|
|
41
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
41
42
|
languageOptions: {
|
|
42
43
|
parser: import_typescript_eslint.default.parser,
|
|
43
44
|
parserOptions: {
|
|
@@ -45,23 +46,31 @@ var NeatlintOptionsDefault = {
|
|
|
45
46
|
sourceType: "module"
|
|
46
47
|
}
|
|
47
48
|
},
|
|
48
|
-
plugins: {
|
|
49
|
+
plugins: {
|
|
50
|
+
"@typescript-eslint": import_typescript_eslint.default.plugin
|
|
51
|
+
},
|
|
49
52
|
rules: {
|
|
53
|
+
...Object.assign({}, ...import_typescript_eslint.default.configs.strictTypeChecked.map((item) => item.rules ?? {})),
|
|
54
|
+
...Object.assign({}, ...import_typescript_eslint.default.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
|
|
50
55
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
56
|
+
// stylisticTypeChecked but different
|
|
51
57
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
52
58
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
53
59
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
54
60
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
55
61
|
"@typescript-eslint/no-inferrable-types": "error",
|
|
62
|
+
// stylisticTypeChecked
|
|
56
63
|
"@typescript-eslint/prefer-readonly": "error",
|
|
57
64
|
"@typescript-eslint/strict-boolean-expressions": "error"
|
|
58
65
|
}
|
|
59
66
|
},
|
|
60
|
-
|
|
61
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
67
|
+
javascript: {
|
|
68
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
62
69
|
languageOptions: {},
|
|
63
70
|
plugins: {},
|
|
64
71
|
rules: {
|
|
72
|
+
...import_js.default.configs.recommended.rules,
|
|
73
|
+
"no-undef": "off",
|
|
65
74
|
"arrow-body-style": "error",
|
|
66
75
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
67
76
|
"no-duplicate-imports": "error",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// src/defaults/NeatlintOptions.default.ts
|
|
2
2
|
import TSESLint from "typescript-eslint";
|
|
3
|
+
import ESLintJS from "@eslint/js";
|
|
3
4
|
var NeatlintOptionsDefault = {
|
|
4
5
|
ignores: ["./dist/**"],
|
|
5
|
-
|
|
6
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
6
|
+
typescript: {
|
|
7
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
7
8
|
languageOptions: {
|
|
8
9
|
parser: TSESLint.parser,
|
|
9
10
|
parserOptions: {
|
|
@@ -11,23 +12,31 @@ var NeatlintOptionsDefault = {
|
|
|
11
12
|
sourceType: "module"
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
|
-
plugins: {
|
|
15
|
+
plugins: {
|
|
16
|
+
"@typescript-eslint": TSESLint.plugin
|
|
17
|
+
},
|
|
15
18
|
rules: {
|
|
19
|
+
...Object.assign({}, ...TSESLint.configs.strictTypeChecked.map((item) => item.rules ?? {})),
|
|
20
|
+
...Object.assign({}, ...TSESLint.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
|
|
16
21
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
22
|
+
// stylisticTypeChecked but different
|
|
17
23
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
18
24
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
19
25
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
20
26
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
21
27
|
"@typescript-eslint/no-inferrable-types": "error",
|
|
28
|
+
// stylisticTypeChecked
|
|
22
29
|
"@typescript-eslint/prefer-readonly": "error",
|
|
23
30
|
"@typescript-eslint/strict-boolean-expressions": "error"
|
|
24
31
|
}
|
|
25
32
|
},
|
|
26
|
-
|
|
27
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
33
|
+
javascript: {
|
|
34
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
28
35
|
languageOptions: {},
|
|
29
36
|
plugins: {},
|
|
30
37
|
rules: {
|
|
38
|
+
...ESLintJS.configs.recommended.rules,
|
|
39
|
+
"no-undef": "off",
|
|
31
40
|
"arrow-body-style": "error",
|
|
32
41
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
33
42
|
"no-duplicate-imports": "error",
|
package/dist/main.js
CHANGED
|
@@ -35,15 +35,15 @@ __export(main_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(main_exports);
|
|
36
36
|
|
|
37
37
|
// src/utils/Neatlint.util.ts
|
|
38
|
-
var import_typescript_eslint2 = __toESM(require("typescript-eslint"));
|
|
39
38
|
var import_lodash = __toESM(require("lodash"));
|
|
40
39
|
|
|
41
40
|
// src/defaults/NeatlintOptions.default.ts
|
|
42
41
|
var import_typescript_eslint = __toESM(require("typescript-eslint"));
|
|
42
|
+
var import_js = __toESM(require("@eslint/js"));
|
|
43
43
|
var NeatlintOptionsDefault = {
|
|
44
44
|
ignores: ["./dist/**"],
|
|
45
|
-
|
|
46
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
45
|
+
typescript: {
|
|
46
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
47
47
|
languageOptions: {
|
|
48
48
|
parser: import_typescript_eslint.default.parser,
|
|
49
49
|
parserOptions: {
|
|
@@ -51,23 +51,31 @@ var NeatlintOptionsDefault = {
|
|
|
51
51
|
sourceType: "module"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
-
plugins: {
|
|
54
|
+
plugins: {
|
|
55
|
+
"@typescript-eslint": import_typescript_eslint.default.plugin
|
|
56
|
+
},
|
|
55
57
|
rules: {
|
|
58
|
+
...Object.assign({}, ...import_typescript_eslint.default.configs.strictTypeChecked.map((item) => item.rules ?? {})),
|
|
59
|
+
...Object.assign({}, ...import_typescript_eslint.default.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
|
|
56
60
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
61
|
+
// stylisticTypeChecked but different
|
|
57
62
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
58
63
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
59
64
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
60
65
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
61
66
|
"@typescript-eslint/no-inferrable-types": "error",
|
|
67
|
+
// stylisticTypeChecked
|
|
62
68
|
"@typescript-eslint/prefer-readonly": "error",
|
|
63
69
|
"@typescript-eslint/strict-boolean-expressions": "error"
|
|
64
70
|
}
|
|
65
71
|
},
|
|
66
|
-
|
|
67
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
72
|
+
javascript: {
|
|
73
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
68
74
|
languageOptions: {},
|
|
69
75
|
plugins: {},
|
|
70
76
|
rules: {
|
|
77
|
+
...import_js.default.configs.recommended.rules,
|
|
78
|
+
"no-undef": "off",
|
|
71
79
|
"arrow-body-style": "error",
|
|
72
80
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
73
81
|
"no-duplicate-imports": "error",
|
|
@@ -92,19 +100,19 @@ var Neatlint = (options = NeatlintOptionsDefault) => {
|
|
|
92
100
|
options = import_lodash.default.merge({}, NeatlintOptionsDefault, options);
|
|
93
101
|
return [
|
|
94
102
|
{ ignores: options.ignores },
|
|
95
|
-
...import_typescript_eslint2.default.configs.strict,
|
|
96
103
|
{
|
|
97
|
-
files: options.
|
|
98
|
-
languageOptions: options.
|
|
99
|
-
plugins: options.
|
|
100
|
-
rules: options.
|
|
104
|
+
files: options.typescript?.files,
|
|
105
|
+
languageOptions: options.typescript?.languageOptions,
|
|
106
|
+
plugins: options.typescript?.plugins,
|
|
107
|
+
rules: options.typescript?.rules
|
|
101
108
|
},
|
|
102
109
|
{
|
|
103
|
-
files: options.
|
|
104
|
-
languageOptions: options.
|
|
105
|
-
plugins: options.
|
|
106
|
-
rules: options.
|
|
107
|
-
}
|
|
110
|
+
files: options.javascript?.files,
|
|
111
|
+
languageOptions: options.javascript?.languageOptions,
|
|
112
|
+
plugins: options.javascript?.plugins,
|
|
113
|
+
rules: options.javascript?.rules
|
|
114
|
+
},
|
|
115
|
+
...options.config && options.config.length !== 0 ? options.config : []
|
|
108
116
|
];
|
|
109
117
|
};
|
|
110
118
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/main.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// src/utils/Neatlint.util.ts
|
|
2
|
-
import TSESLint2 from "typescript-eslint";
|
|
3
2
|
import _ from "lodash";
|
|
4
3
|
|
|
5
4
|
// src/defaults/NeatlintOptions.default.ts
|
|
6
5
|
import TSESLint from "typescript-eslint";
|
|
6
|
+
import ESLintJS from "@eslint/js";
|
|
7
7
|
var NeatlintOptionsDefault = {
|
|
8
8
|
ignores: ["./dist/**"],
|
|
9
|
-
|
|
10
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
9
|
+
typescript: {
|
|
10
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
11
11
|
languageOptions: {
|
|
12
12
|
parser: TSESLint.parser,
|
|
13
13
|
parserOptions: {
|
|
@@ -15,23 +15,31 @@ var NeatlintOptionsDefault = {
|
|
|
15
15
|
sourceType: "module"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
plugins: {
|
|
18
|
+
plugins: {
|
|
19
|
+
"@typescript-eslint": TSESLint.plugin
|
|
20
|
+
},
|
|
19
21
|
rules: {
|
|
22
|
+
...Object.assign({}, ...TSESLint.configs.strictTypeChecked.map((item) => item.rules ?? {})),
|
|
23
|
+
...Object.assign({}, ...TSESLint.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
|
|
20
24
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
25
|
+
// stylisticTypeChecked but different
|
|
21
26
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
22
27
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
23
28
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
24
29
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
25
30
|
"@typescript-eslint/no-inferrable-types": "error",
|
|
31
|
+
// stylisticTypeChecked
|
|
26
32
|
"@typescript-eslint/prefer-readonly": "error",
|
|
27
33
|
"@typescript-eslint/strict-boolean-expressions": "error"
|
|
28
34
|
}
|
|
29
35
|
},
|
|
30
|
-
|
|
31
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
36
|
+
javascript: {
|
|
37
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
32
38
|
languageOptions: {},
|
|
33
39
|
plugins: {},
|
|
34
40
|
rules: {
|
|
41
|
+
...ESLintJS.configs.recommended.rules,
|
|
42
|
+
"no-undef": "off",
|
|
35
43
|
"arrow-body-style": "error",
|
|
36
44
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
37
45
|
"no-duplicate-imports": "error",
|
|
@@ -56,19 +64,19 @@ var Neatlint = (options = NeatlintOptionsDefault) => {
|
|
|
56
64
|
options = _.merge({}, NeatlintOptionsDefault, options);
|
|
57
65
|
return [
|
|
58
66
|
{ ignores: options.ignores },
|
|
59
|
-
...TSESLint2.configs.strict,
|
|
60
67
|
{
|
|
61
|
-
files: options.
|
|
62
|
-
languageOptions: options.
|
|
63
|
-
plugins: options.
|
|
64
|
-
rules: options.
|
|
68
|
+
files: options.typescript?.files,
|
|
69
|
+
languageOptions: options.typescript?.languageOptions,
|
|
70
|
+
plugins: options.typescript?.plugins,
|
|
71
|
+
rules: options.typescript?.rules
|
|
65
72
|
},
|
|
66
73
|
{
|
|
67
|
-
files: options.
|
|
68
|
-
languageOptions: options.
|
|
69
|
-
plugins: options.
|
|
70
|
-
rules: options.
|
|
71
|
-
}
|
|
74
|
+
files: options.javascript?.files,
|
|
75
|
+
languageOptions: options.javascript?.languageOptions,
|
|
76
|
+
plugins: options.javascript?.plugins,
|
|
77
|
+
rules: options.javascript?.rules
|
|
78
|
+
},
|
|
79
|
+
...options.config && options.config.length !== 0 ? options.config : []
|
|
72
80
|
];
|
|
73
81
|
};
|
|
74
82
|
export {
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
type NeatlintOptions = {
|
|
2
|
-
ignores
|
|
3
|
-
|
|
4
|
-
files
|
|
5
|
-
languageOptions
|
|
6
|
-
plugins
|
|
7
|
-
rules
|
|
2
|
+
ignores?: string[];
|
|
3
|
+
typescript?: {
|
|
4
|
+
files?: string[];
|
|
5
|
+
languageOptions?: object;
|
|
6
|
+
plugins?: Record<string, unknown>;
|
|
7
|
+
rules?: Record<string, string | object>;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
javascript?: {
|
|
10
|
+
files?: string[];
|
|
11
|
+
languageOptions?: object;
|
|
12
|
+
plugins?: Record<string, unknown>;
|
|
13
|
+
rules?: Record<string, string | object>;
|
|
14
|
+
};
|
|
15
|
+
config?: {
|
|
10
16
|
files: string[];
|
|
11
|
-
|
|
12
|
-
plugins: Record<string, unknown>;
|
|
17
|
+
[key: string]: unknown;
|
|
13
18
|
rules: Record<string, string | object>;
|
|
14
|
-
};
|
|
19
|
+
}[];
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
export type { NeatlintOptions };
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
type NeatlintOptions = {
|
|
2
|
-
ignores
|
|
3
|
-
|
|
4
|
-
files
|
|
5
|
-
languageOptions
|
|
6
|
-
plugins
|
|
7
|
-
rules
|
|
2
|
+
ignores?: string[];
|
|
3
|
+
typescript?: {
|
|
4
|
+
files?: string[];
|
|
5
|
+
languageOptions?: object;
|
|
6
|
+
plugins?: Record<string, unknown>;
|
|
7
|
+
rules?: Record<string, string | object>;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
javascript?: {
|
|
10
|
+
files?: string[];
|
|
11
|
+
languageOptions?: object;
|
|
12
|
+
plugins?: Record<string, unknown>;
|
|
13
|
+
rules?: Record<string, string | object>;
|
|
14
|
+
};
|
|
15
|
+
config?: {
|
|
10
16
|
files: string[];
|
|
11
|
-
|
|
12
|
-
plugins: Record<string, unknown>;
|
|
17
|
+
[key: string]: unknown;
|
|
13
18
|
rules: Record<string, string | object>;
|
|
14
|
-
};
|
|
19
|
+
}[];
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
export type { NeatlintOptions };
|
|
@@ -33,15 +33,15 @@ __export(Neatlint_util_exports, {
|
|
|
33
33
|
Neatlint: () => Neatlint
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(Neatlint_util_exports);
|
|
36
|
-
var import_typescript_eslint2 = __toESM(require("typescript-eslint"));
|
|
37
36
|
var import_lodash = __toESM(require("lodash"));
|
|
38
37
|
|
|
39
38
|
// src/defaults/NeatlintOptions.default.ts
|
|
40
39
|
var import_typescript_eslint = __toESM(require("typescript-eslint"));
|
|
40
|
+
var import_js = __toESM(require("@eslint/js"));
|
|
41
41
|
var NeatlintOptionsDefault = {
|
|
42
42
|
ignores: ["./dist/**"],
|
|
43
|
-
|
|
44
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
43
|
+
typescript: {
|
|
44
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
45
45
|
languageOptions: {
|
|
46
46
|
parser: import_typescript_eslint.default.parser,
|
|
47
47
|
parserOptions: {
|
|
@@ -49,23 +49,31 @@ var NeatlintOptionsDefault = {
|
|
|
49
49
|
sourceType: "module"
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
|
-
plugins: {
|
|
52
|
+
plugins: {
|
|
53
|
+
"@typescript-eslint": import_typescript_eslint.default.plugin
|
|
54
|
+
},
|
|
53
55
|
rules: {
|
|
56
|
+
...Object.assign({}, ...import_typescript_eslint.default.configs.strictTypeChecked.map((item) => item.rules ?? {})),
|
|
57
|
+
...Object.assign({}, ...import_typescript_eslint.default.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
|
|
54
58
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
59
|
+
// stylisticTypeChecked but different
|
|
55
60
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
56
61
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
57
62
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
58
63
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
59
64
|
"@typescript-eslint/no-inferrable-types": "error",
|
|
65
|
+
// stylisticTypeChecked
|
|
60
66
|
"@typescript-eslint/prefer-readonly": "error",
|
|
61
67
|
"@typescript-eslint/strict-boolean-expressions": "error"
|
|
62
68
|
}
|
|
63
69
|
},
|
|
64
|
-
|
|
65
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
70
|
+
javascript: {
|
|
71
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
66
72
|
languageOptions: {},
|
|
67
73
|
plugins: {},
|
|
68
74
|
rules: {
|
|
75
|
+
...import_js.default.configs.recommended.rules,
|
|
76
|
+
"no-undef": "off",
|
|
69
77
|
"arrow-body-style": "error",
|
|
70
78
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
71
79
|
"no-duplicate-imports": "error",
|
|
@@ -90,19 +98,19 @@ var Neatlint = (options = NeatlintOptionsDefault) => {
|
|
|
90
98
|
options = import_lodash.default.merge({}, NeatlintOptionsDefault, options);
|
|
91
99
|
return [
|
|
92
100
|
{ ignores: options.ignores },
|
|
93
|
-
...import_typescript_eslint2.default.configs.strict,
|
|
94
101
|
{
|
|
95
|
-
files: options.
|
|
96
|
-
languageOptions: options.
|
|
97
|
-
plugins: options.
|
|
98
|
-
rules: options.
|
|
102
|
+
files: options.typescript?.files,
|
|
103
|
+
languageOptions: options.typescript?.languageOptions,
|
|
104
|
+
plugins: options.typescript?.plugins,
|
|
105
|
+
rules: options.typescript?.rules
|
|
99
106
|
},
|
|
100
107
|
{
|
|
101
|
-
files: options.
|
|
102
|
-
languageOptions: options.
|
|
103
|
-
plugins: options.
|
|
104
|
-
rules: options.
|
|
105
|
-
}
|
|
108
|
+
files: options.javascript?.files,
|
|
109
|
+
languageOptions: options.javascript?.languageOptions,
|
|
110
|
+
plugins: options.javascript?.plugins,
|
|
111
|
+
rules: options.javascript?.rules
|
|
112
|
+
},
|
|
113
|
+
...options.config && options.config.length !== 0 ? options.config : []
|
|
106
114
|
];
|
|
107
115
|
};
|
|
108
116
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// src/utils/Neatlint.util.ts
|
|
2
|
-
import TSESLint2 from "typescript-eslint";
|
|
3
2
|
import _ from "lodash";
|
|
4
3
|
|
|
5
4
|
// src/defaults/NeatlintOptions.default.ts
|
|
6
5
|
import TSESLint from "typescript-eslint";
|
|
6
|
+
import ESLintJS from "@eslint/js";
|
|
7
7
|
var NeatlintOptionsDefault = {
|
|
8
8
|
ignores: ["./dist/**"],
|
|
9
|
-
|
|
10
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
9
|
+
typescript: {
|
|
10
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
11
11
|
languageOptions: {
|
|
12
12
|
parser: TSESLint.parser,
|
|
13
13
|
parserOptions: {
|
|
@@ -15,23 +15,31 @@ var NeatlintOptionsDefault = {
|
|
|
15
15
|
sourceType: "module"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
|
-
plugins: {
|
|
18
|
+
plugins: {
|
|
19
|
+
"@typescript-eslint": TSESLint.plugin
|
|
20
|
+
},
|
|
19
21
|
rules: {
|
|
22
|
+
...Object.assign({}, ...TSESLint.configs.strictTypeChecked.map((item) => item.rules ?? {})),
|
|
23
|
+
...Object.assign({}, ...TSESLint.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
|
|
20
24
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
25
|
+
// stylisticTypeChecked but different
|
|
21
26
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
22
27
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
23
28
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
24
29
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
25
30
|
"@typescript-eslint/no-inferrable-types": "error",
|
|
31
|
+
// stylisticTypeChecked
|
|
26
32
|
"@typescript-eslint/prefer-readonly": "error",
|
|
27
33
|
"@typescript-eslint/strict-boolean-expressions": "error"
|
|
28
34
|
}
|
|
29
35
|
},
|
|
30
|
-
|
|
31
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
36
|
+
javascript: {
|
|
37
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
32
38
|
languageOptions: {},
|
|
33
39
|
plugins: {},
|
|
34
40
|
rules: {
|
|
41
|
+
...ESLintJS.configs.recommended.rules,
|
|
42
|
+
"no-undef": "off",
|
|
35
43
|
"arrow-body-style": "error",
|
|
36
44
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
37
45
|
"no-duplicate-imports": "error",
|
|
@@ -56,19 +64,19 @@ var Neatlint = (options = NeatlintOptionsDefault) => {
|
|
|
56
64
|
options = _.merge({}, NeatlintOptionsDefault, options);
|
|
57
65
|
return [
|
|
58
66
|
{ ignores: options.ignores },
|
|
59
|
-
...TSESLint2.configs.strict,
|
|
60
67
|
{
|
|
61
|
-
files: options.
|
|
62
|
-
languageOptions: options.
|
|
63
|
-
plugins: options.
|
|
64
|
-
rules: options.
|
|
68
|
+
files: options.typescript?.files,
|
|
69
|
+
languageOptions: options.typescript?.languageOptions,
|
|
70
|
+
plugins: options.typescript?.plugins,
|
|
71
|
+
rules: options.typescript?.rules
|
|
65
72
|
},
|
|
66
73
|
{
|
|
67
|
-
files: options.
|
|
68
|
-
languageOptions: options.
|
|
69
|
-
plugins: options.
|
|
70
|
-
rules: options.
|
|
71
|
-
}
|
|
74
|
+
files: options.javascript?.files,
|
|
75
|
+
languageOptions: options.javascript?.languageOptions,
|
|
76
|
+
plugins: options.javascript?.plugins,
|
|
77
|
+
rules: options.javascript?.rules
|
|
78
|
+
},
|
|
79
|
+
...options.config && options.config.length !== 0 ? options.config : []
|
|
72
80
|
];
|
|
73
81
|
};
|
|
74
82
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neatlint",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Strict ESLint presets for modern TypeScript projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/keift/neatlint",
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
"lint": "eslint ./"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@eslint/js": "^9.35.0",
|
|
18
19
|
"@types/lodash": "^4.17.20",
|
|
19
20
|
"jiti": "^2.5.1",
|
|
20
21
|
"lodash": "^4.17.21",
|
|
21
22
|
"typescript": "^5.9.2",
|
|
22
|
-
"typescript-eslint": "^8.
|
|
23
|
+
"typescript-eslint": "^8.43.0"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"prettier": "^3.6.2",
|