neatlint 1.0.3 → 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 -32
- package/dist/defaults/NeatlintOptions.default.js +15 -7
- package/dist/defaults/NeatlintOptions.default.mjs +15 -7
- package/dist/main.js +25 -21
- package/dist/main.mjs +25 -21
- package/dist/types/NeatlintOptions.type.d.mts +15 -12
- package/dist/types/NeatlintOptions.type.d.ts +15 -12
- package/dist/utils/Neatlint.util.js +25 -21
- package/dist/utils/Neatlint.util.mjs +25 -21
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
- [Import](#import)
|
|
33
33
|
- [Methods](#methods)
|
|
34
34
|
- [Recommended use](#recommended-use)
|
|
35
|
-
- [What does it do?](#what-does-it-do)
|
|
36
35
|
- [Types](#types)
|
|
37
36
|
- [Links](#links)
|
|
38
37
|
- [Discord](https://discord.gg/keift)
|
|
@@ -85,7 +84,7 @@ deno install npm:neatlint
|
|
|
85
84
|
Briefly as follows.
|
|
86
85
|
|
|
87
86
|
```typescript
|
|
88
|
-
|
|
87
|
+
Neatlint
|
|
89
88
|
│
|
|
90
89
|
├── Neatlint(options?)
|
|
91
90
|
│
|
|
@@ -126,7 +125,7 @@ Get the ESLint configuration generated by Neatlint.
|
|
|
126
125
|
|
|
127
126
|
### Recommended use
|
|
128
127
|
|
|
129
|
-
Suggested uses are as follows. We recommend using Prettier.
|
|
128
|
+
Suggested uses are as follows. We recommend using [Prettier](https://npmjs.com/package/prettier).
|
|
130
129
|
|
|
131
130
|
> **📁 ./eslint.config.ts**
|
|
132
131
|
>
|
|
@@ -168,35 +167,6 @@ Suggested uses are as follows. We recommend using Prettier.
|
|
|
168
167
|
> }
|
|
169
168
|
> ```
|
|
170
169
|
|
|
171
|
-
### What does it do?
|
|
172
|
-
|
|
173
|
-
Neatlint offers strict ESLint settings. These rules also include [strict-type-checked](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/strict-type-checked.ts), [stylistic-type-checked](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslintrc/stylistic-type-checked.ts) and [eslint-recommended](https://npmjs.com/package/@eslint/js).
|
|
174
|
-
|
|
175
|
-
| Rule | Description |
|
|
176
|
-
| -------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
177
|
-
| [arrow-body-style](https://eslint.org/docs/latest/rules/arrow-body-style) | Require braces around arrow function bodies. |
|
|
178
|
-
| [func-style](https://eslint.org/docs/latest/rules/func-style) | Enforce the consistent use of either function declarations or expressions assigned to variables. |
|
|
179
|
-
| [no-duplicate-imports](https://eslint.org/docs/latest/rules/no-duplicate-imports) | Disallow duplicate module imports. |
|
|
180
|
-
| [no-restricted-syntax](https://eslint.org/docs/latest/rules/no-restricted-syntax) | Disallow specified syntax. |
|
|
181
|
-
| [no-useless-computed-key](https://eslint.org/docs/latest/rules/no-useless-computed-key) | Disallow unnecessary computed property keys in objects and classes. |
|
|
182
|
-
| [no-useless-concat](https://eslint.org/docs/latest/rules/no-useless-concat) | Disallow unnecessary concatenation of literals or template literals. |
|
|
183
|
-
| [no-useless-constructor](https://eslint.org/docs/latest/rules/no-useless-constructor) | Disallow unnecessary constructors. |
|
|
184
|
-
| [no-useless-rename](https://eslint.org/docs/latest/rules/no-useless-rename) | Disallow renaming import, export, and destructured assignments to the same name. |
|
|
185
|
-
| [no-useless-return](https://eslint.org/docs/latest/rules/no-useless-return) | Disallow redundant return statements. |
|
|
186
|
-
| [no-var](https://eslint.org/docs/latest/rules/no-var) | Require let or const instead of var. |
|
|
187
|
-
| [object-shorthand](https://eslint.org/docs/latest/rules/object-shorthand) | Require or disallow method and property shorthand syntax for object literals. |
|
|
188
|
-
| [prefer-arrow-callback](https://eslint.org/docs/latest/rules/prefer-arrow-callback) | Require using arrow functions for callbacks. |
|
|
189
|
-
| [prefer-const](https://eslint.org/docs/latest/rules/prefer-const) | Require const declarations for variables that are never reassigned after declared. |
|
|
190
|
-
| [prefer-template](https://eslint.org/docs/latest/rules/prefer-template) | Require template literals instead of string concatenation. |
|
|
191
|
-
| [eqeqeq](https://eslint.org/docs/latest/rules/eqeqeq) | Require the use of === and !==. |
|
|
192
|
-
| [@typescript-eslint/consistent-type-definitions](https://typescript-eslint.io/rules/consistent-type-definitions) | Enforce type definitions to consistently use either interface or type. |
|
|
193
|
-
| [@typescript-eslint/consistent-type-exports](https://typescript-eslint.io/rules/consistent-type-exports) | Enforce consistent usage of type exports. |
|
|
194
|
-
| [@typescript-eslint/consistent-type-imports](https://typescript-eslint.io/rules/consistent-type-imports) | Enforce consistent usage of type imports. |
|
|
195
|
-
| [@typescript-eslint/explicit-function-return-type](https://typescript-eslint.io/rules/explicit-function-return-type) | Require explicit return types on functions and class methods. |
|
|
196
|
-
| [@typescript-eslint/explicit-member-accessibility](https://typescript-eslint.io/rules/explicit-member-accessibility) | Require explicit accessibility modifiers on class properties and methods. |
|
|
197
|
-
| [@typescript-eslint/prefer-readonly](https://typescript-eslint.io/rules/prefer-readonly) | Require private members to be marked as readonly if they're never modified outside of the constructor. |
|
|
198
|
-
| [@typescript-eslint/strict-boolean-expressions](https://typescript-eslint.io/rules/strict-boolean-expressions) | Disallow certain types in boolean expressions. |
|
|
199
|
-
|
|
200
170
|
### Types
|
|
201
171
|
|
|
202
172
|
| Type |
|
|
@@ -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,24 +46,31 @@ var NeatlintOptionsDefault = {
|
|
|
45
46
|
sourceType: "module"
|
|
46
47
|
}
|
|
47
48
|
},
|
|
48
|
-
plugins: {
|
|
49
|
-
|
|
49
|
+
plugins: {
|
|
50
|
+
"@typescript-eslint": import_typescript_eslint.default.plugin
|
|
51
|
+
},
|
|
50
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 ?? {})),
|
|
51
55
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
56
|
+
// stylisticTypeChecked but different
|
|
52
57
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
53
58
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
54
59
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
55
60
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
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
|
-
extends: [],
|
|
65
71
|
rules: {
|
|
72
|
+
...import_js.default.configs.recommended.rules,
|
|
73
|
+
"no-undef": "off",
|
|
66
74
|
"arrow-body-style": "error",
|
|
67
75
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
68
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,24 +12,31 @@ var NeatlintOptionsDefault = {
|
|
|
11
12
|
sourceType: "module"
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
|
-
plugins: {
|
|
15
|
-
|
|
15
|
+
plugins: {
|
|
16
|
+
"@typescript-eslint": TSESLint.plugin
|
|
17
|
+
},
|
|
16
18
|
rules: {
|
|
19
|
+
...Object.assign({}, ...TSESLint.configs.strictTypeChecked.map((item) => item.rules ?? {})),
|
|
20
|
+
...Object.assign({}, ...TSESLint.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
|
|
17
21
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
22
|
+
// stylisticTypeChecked but different
|
|
18
23
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
19
24
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
20
25
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
21
26
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
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
|
-
extends: [],
|
|
31
37
|
rules: {
|
|
38
|
+
...ESLintJS.configs.recommended.rules,
|
|
39
|
+
"no-undef": "off",
|
|
32
40
|
"arrow-body-style": "error",
|
|
33
41
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
34
42
|
"no-duplicate-imports": "error",
|
package/dist/main.js
CHANGED
|
@@ -35,16 +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
|
-
var import_js = __toESM(require("@eslint/js"));
|
|
40
38
|
var import_lodash = __toESM(require("lodash"));
|
|
41
39
|
|
|
42
40
|
// src/defaults/NeatlintOptions.default.ts
|
|
43
41
|
var import_typescript_eslint = __toESM(require("typescript-eslint"));
|
|
42
|
+
var import_js = __toESM(require("@eslint/js"));
|
|
44
43
|
var NeatlintOptionsDefault = {
|
|
45
44
|
ignores: ["./dist/**"],
|
|
46
|
-
|
|
47
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
45
|
+
typescript: {
|
|
46
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
48
47
|
languageOptions: {
|
|
49
48
|
parser: import_typescript_eslint.default.parser,
|
|
50
49
|
parserOptions: {
|
|
@@ -52,24 +51,31 @@ var NeatlintOptionsDefault = {
|
|
|
52
51
|
sourceType: "module"
|
|
53
52
|
}
|
|
54
53
|
},
|
|
55
|
-
plugins: {
|
|
56
|
-
|
|
54
|
+
plugins: {
|
|
55
|
+
"@typescript-eslint": import_typescript_eslint.default.plugin
|
|
56
|
+
},
|
|
57
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 ?? {})),
|
|
58
60
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
61
|
+
// stylisticTypeChecked but different
|
|
59
62
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
60
63
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
61
64
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
62
65
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
66
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
67
|
+
// stylisticTypeChecked
|
|
63
68
|
"@typescript-eslint/prefer-readonly": "error",
|
|
64
69
|
"@typescript-eslint/strict-boolean-expressions": "error"
|
|
65
70
|
}
|
|
66
71
|
},
|
|
67
|
-
|
|
68
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
72
|
+
javascript: {
|
|
73
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
69
74
|
languageOptions: {},
|
|
70
75
|
plugins: {},
|
|
71
|
-
extends: [],
|
|
72
76
|
rules: {
|
|
77
|
+
...import_js.default.configs.recommended.rules,
|
|
78
|
+
"no-undef": "off",
|
|
73
79
|
"arrow-body-style": "error",
|
|
74
80
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
75
81
|
"no-duplicate-imports": "error",
|
|
@@ -94,21 +100,19 @@ var Neatlint = (options = NeatlintOptionsDefault) => {
|
|
|
94
100
|
options = import_lodash.default.merge({}, NeatlintOptionsDefault, options);
|
|
95
101
|
return [
|
|
96
102
|
{ ignores: options.ignores },
|
|
97
|
-
...import_typescript_eslint2.default.configs.strictTypeChecked,
|
|
98
|
-
...import_typescript_eslint2.default.configs.stylisticTypeChecked,
|
|
99
|
-
import_js.default.configs.recommended,
|
|
100
103
|
{
|
|
101
|
-
files: options.
|
|
102
|
-
languageOptions: options.
|
|
103
|
-
plugins: options.
|
|
104
|
-
rules: options.
|
|
104
|
+
files: options.typescript?.files,
|
|
105
|
+
languageOptions: options.typescript?.languageOptions,
|
|
106
|
+
plugins: options.typescript?.plugins,
|
|
107
|
+
rules: options.typescript?.rules
|
|
105
108
|
},
|
|
106
109
|
{
|
|
107
|
-
files: options.
|
|
108
|
-
languageOptions: options.
|
|
109
|
-
plugins: options.
|
|
110
|
-
rules: options.
|
|
111
|
-
}
|
|
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 : []
|
|
112
116
|
];
|
|
113
117
|
};
|
|
114
118
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/main.mjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// src/utils/Neatlint.util.ts
|
|
2
|
-
import TSESLint2 from "typescript-eslint";
|
|
3
|
-
import ESLintJS from "@eslint/js";
|
|
4
2
|
import _ from "lodash";
|
|
5
3
|
|
|
6
4
|
// src/defaults/NeatlintOptions.default.ts
|
|
7
5
|
import TSESLint from "typescript-eslint";
|
|
6
|
+
import ESLintJS from "@eslint/js";
|
|
8
7
|
var NeatlintOptionsDefault = {
|
|
9
8
|
ignores: ["./dist/**"],
|
|
10
|
-
|
|
11
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
9
|
+
typescript: {
|
|
10
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
12
11
|
languageOptions: {
|
|
13
12
|
parser: TSESLint.parser,
|
|
14
13
|
parserOptions: {
|
|
@@ -16,24 +15,31 @@ var NeatlintOptionsDefault = {
|
|
|
16
15
|
sourceType: "module"
|
|
17
16
|
}
|
|
18
17
|
},
|
|
19
|
-
plugins: {
|
|
20
|
-
|
|
18
|
+
plugins: {
|
|
19
|
+
"@typescript-eslint": TSESLint.plugin
|
|
20
|
+
},
|
|
21
21
|
rules: {
|
|
22
|
+
...Object.assign({}, ...TSESLint.configs.strictTypeChecked.map((item) => item.rules ?? {})),
|
|
23
|
+
...Object.assign({}, ...TSESLint.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
|
|
22
24
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
25
|
+
// stylisticTypeChecked but different
|
|
23
26
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
24
27
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
25
28
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
26
29
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
30
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
31
|
+
// stylisticTypeChecked
|
|
27
32
|
"@typescript-eslint/prefer-readonly": "error",
|
|
28
33
|
"@typescript-eslint/strict-boolean-expressions": "error"
|
|
29
34
|
}
|
|
30
35
|
},
|
|
31
|
-
|
|
32
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
36
|
+
javascript: {
|
|
37
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
33
38
|
languageOptions: {},
|
|
34
39
|
plugins: {},
|
|
35
|
-
extends: [],
|
|
36
40
|
rules: {
|
|
41
|
+
...ESLintJS.configs.recommended.rules,
|
|
42
|
+
"no-undef": "off",
|
|
37
43
|
"arrow-body-style": "error",
|
|
38
44
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
39
45
|
"no-duplicate-imports": "error",
|
|
@@ -58,21 +64,19 @@ var Neatlint = (options = NeatlintOptionsDefault) => {
|
|
|
58
64
|
options = _.merge({}, NeatlintOptionsDefault, options);
|
|
59
65
|
return [
|
|
60
66
|
{ ignores: options.ignores },
|
|
61
|
-
...TSESLint2.configs.strictTypeChecked,
|
|
62
|
-
...TSESLint2.configs.stylisticTypeChecked,
|
|
63
|
-
ESLintJS.configs.recommended,
|
|
64
67
|
{
|
|
65
|
-
files: options.
|
|
66
|
-
languageOptions: options.
|
|
67
|
-
plugins: options.
|
|
68
|
-
rules: options.
|
|
68
|
+
files: options.typescript?.files,
|
|
69
|
+
languageOptions: options.typescript?.languageOptions,
|
|
70
|
+
plugins: options.typescript?.plugins,
|
|
71
|
+
rules: options.typescript?.rules
|
|
69
72
|
},
|
|
70
73
|
{
|
|
71
|
-
files: options.
|
|
72
|
-
languageOptions: options.
|
|
73
|
-
plugins: options.
|
|
74
|
-
rules: options.
|
|
75
|
-
}
|
|
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 : []
|
|
76
80
|
];
|
|
77
81
|
};
|
|
78
82
|
export {
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
type NeatlintOptions = {
|
|
2
|
-
ignores
|
|
3
|
-
|
|
4
|
-
files
|
|
5
|
-
languageOptions
|
|
6
|
-
plugins
|
|
7
|
-
|
|
8
|
-
rules: Record<string, string | object>;
|
|
2
|
+
ignores?: string[];
|
|
3
|
+
typescript?: {
|
|
4
|
+
files?: string[];
|
|
5
|
+
languageOptions?: object;
|
|
6
|
+
plugins?: Record<string, unknown>;
|
|
7
|
+
rules?: Record<string, string | object>;
|
|
9
8
|
};
|
|
10
|
-
|
|
9
|
+
javascript?: {
|
|
10
|
+
files?: string[];
|
|
11
|
+
languageOptions?: object;
|
|
12
|
+
plugins?: Record<string, unknown>;
|
|
13
|
+
rules?: Record<string, string | object>;
|
|
14
|
+
};
|
|
15
|
+
config?: {
|
|
11
16
|
files: string[];
|
|
12
|
-
|
|
13
|
-
plugins: Record<string, unknown>;
|
|
14
|
-
extends: string[];
|
|
17
|
+
[key: string]: unknown;
|
|
15
18
|
rules: Record<string, string | object>;
|
|
16
|
-
};
|
|
19
|
+
}[];
|
|
17
20
|
};
|
|
18
21
|
|
|
19
22
|
export type { NeatlintOptions };
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
type NeatlintOptions = {
|
|
2
|
-
ignores
|
|
3
|
-
|
|
4
|
-
files
|
|
5
|
-
languageOptions
|
|
6
|
-
plugins
|
|
7
|
-
|
|
8
|
-
rules: Record<string, string | object>;
|
|
2
|
+
ignores?: string[];
|
|
3
|
+
typescript?: {
|
|
4
|
+
files?: string[];
|
|
5
|
+
languageOptions?: object;
|
|
6
|
+
plugins?: Record<string, unknown>;
|
|
7
|
+
rules?: Record<string, string | object>;
|
|
9
8
|
};
|
|
10
|
-
|
|
9
|
+
javascript?: {
|
|
10
|
+
files?: string[];
|
|
11
|
+
languageOptions?: object;
|
|
12
|
+
plugins?: Record<string, unknown>;
|
|
13
|
+
rules?: Record<string, string | object>;
|
|
14
|
+
};
|
|
15
|
+
config?: {
|
|
11
16
|
files: string[];
|
|
12
|
-
|
|
13
|
-
plugins: Record<string, unknown>;
|
|
14
|
-
extends: string[];
|
|
17
|
+
[key: string]: unknown;
|
|
15
18
|
rules: Record<string, string | object>;
|
|
16
|
-
};
|
|
19
|
+
}[];
|
|
17
20
|
};
|
|
18
21
|
|
|
19
22
|
export type { NeatlintOptions };
|
|
@@ -33,16 +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
|
-
var import_js = __toESM(require("@eslint/js"));
|
|
38
36
|
var import_lodash = __toESM(require("lodash"));
|
|
39
37
|
|
|
40
38
|
// src/defaults/NeatlintOptions.default.ts
|
|
41
39
|
var import_typescript_eslint = __toESM(require("typescript-eslint"));
|
|
40
|
+
var import_js = __toESM(require("@eslint/js"));
|
|
42
41
|
var NeatlintOptionsDefault = {
|
|
43
42
|
ignores: ["./dist/**"],
|
|
44
|
-
|
|
45
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
43
|
+
typescript: {
|
|
44
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
46
45
|
languageOptions: {
|
|
47
46
|
parser: import_typescript_eslint.default.parser,
|
|
48
47
|
parserOptions: {
|
|
@@ -50,24 +49,31 @@ var NeatlintOptionsDefault = {
|
|
|
50
49
|
sourceType: "module"
|
|
51
50
|
}
|
|
52
51
|
},
|
|
53
|
-
plugins: {
|
|
54
|
-
|
|
52
|
+
plugins: {
|
|
53
|
+
"@typescript-eslint": import_typescript_eslint.default.plugin
|
|
54
|
+
},
|
|
55
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 ?? {})),
|
|
56
58
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
59
|
+
// stylisticTypeChecked but different
|
|
57
60
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
58
61
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
59
62
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
60
63
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
64
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
65
|
+
// stylisticTypeChecked
|
|
61
66
|
"@typescript-eslint/prefer-readonly": "error",
|
|
62
67
|
"@typescript-eslint/strict-boolean-expressions": "error"
|
|
63
68
|
}
|
|
64
69
|
},
|
|
65
|
-
|
|
66
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
70
|
+
javascript: {
|
|
71
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
67
72
|
languageOptions: {},
|
|
68
73
|
plugins: {},
|
|
69
|
-
extends: [],
|
|
70
74
|
rules: {
|
|
75
|
+
...import_js.default.configs.recommended.rules,
|
|
76
|
+
"no-undef": "off",
|
|
71
77
|
"arrow-body-style": "error",
|
|
72
78
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
73
79
|
"no-duplicate-imports": "error",
|
|
@@ -92,21 +98,19 @@ var Neatlint = (options = NeatlintOptionsDefault) => {
|
|
|
92
98
|
options = import_lodash.default.merge({}, NeatlintOptionsDefault, options);
|
|
93
99
|
return [
|
|
94
100
|
{ ignores: options.ignores },
|
|
95
|
-
...import_typescript_eslint2.default.configs.strictTypeChecked,
|
|
96
|
-
...import_typescript_eslint2.default.configs.stylisticTypeChecked,
|
|
97
|
-
import_js.default.configs.recommended,
|
|
98
101
|
{
|
|
99
|
-
files: options.
|
|
100
|
-
languageOptions: options.
|
|
101
|
-
plugins: options.
|
|
102
|
-
rules: options.
|
|
102
|
+
files: options.typescript?.files,
|
|
103
|
+
languageOptions: options.typescript?.languageOptions,
|
|
104
|
+
plugins: options.typescript?.plugins,
|
|
105
|
+
rules: options.typescript?.rules
|
|
103
106
|
},
|
|
104
107
|
{
|
|
105
|
-
files: options.
|
|
106
|
-
languageOptions: options.
|
|
107
|
-
plugins: options.
|
|
108
|
-
rules: options.
|
|
109
|
-
}
|
|
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 : []
|
|
110
114
|
];
|
|
111
115
|
};
|
|
112
116
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// src/utils/Neatlint.util.ts
|
|
2
|
-
import TSESLint2 from "typescript-eslint";
|
|
3
|
-
import ESLintJS from "@eslint/js";
|
|
4
2
|
import _ from "lodash";
|
|
5
3
|
|
|
6
4
|
// src/defaults/NeatlintOptions.default.ts
|
|
7
5
|
import TSESLint from "typescript-eslint";
|
|
6
|
+
import ESLintJS from "@eslint/js";
|
|
8
7
|
var NeatlintOptionsDefault = {
|
|
9
8
|
ignores: ["./dist/**"],
|
|
10
|
-
|
|
11
|
-
files: ["**/*.ts", "**/*.tsx"],
|
|
9
|
+
typescript: {
|
|
10
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
12
11
|
languageOptions: {
|
|
13
12
|
parser: TSESLint.parser,
|
|
14
13
|
parserOptions: {
|
|
@@ -16,24 +15,31 @@ var NeatlintOptionsDefault = {
|
|
|
16
15
|
sourceType: "module"
|
|
17
16
|
}
|
|
18
17
|
},
|
|
19
|
-
plugins: {
|
|
20
|
-
|
|
18
|
+
plugins: {
|
|
19
|
+
"@typescript-eslint": TSESLint.plugin
|
|
20
|
+
},
|
|
21
21
|
rules: {
|
|
22
|
+
...Object.assign({}, ...TSESLint.configs.strictTypeChecked.map((item) => item.rules ?? {})),
|
|
23
|
+
...Object.assign({}, ...TSESLint.configs.stylisticTypeChecked.map((item) => item.rules ?? {})),
|
|
22
24
|
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
|
|
25
|
+
// stylisticTypeChecked but different
|
|
23
26
|
"@typescript-eslint/consistent-type-exports": "error",
|
|
24
27
|
"@typescript-eslint/consistent-type-imports": "error",
|
|
25
28
|
"@typescript-eslint/explicit-function-return-type": "error",
|
|
26
29
|
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
30
|
+
"@typescript-eslint/no-inferrable-types": "error",
|
|
31
|
+
// stylisticTypeChecked
|
|
27
32
|
"@typescript-eslint/prefer-readonly": "error",
|
|
28
33
|
"@typescript-eslint/strict-boolean-expressions": "error"
|
|
29
34
|
}
|
|
30
35
|
},
|
|
31
|
-
|
|
32
|
-
files: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
36
|
+
javascript: {
|
|
37
|
+
files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
|
|
33
38
|
languageOptions: {},
|
|
34
39
|
plugins: {},
|
|
35
|
-
extends: [],
|
|
36
40
|
rules: {
|
|
41
|
+
...ESLintJS.configs.recommended.rules,
|
|
42
|
+
"no-undef": "off",
|
|
37
43
|
"arrow-body-style": "error",
|
|
38
44
|
"func-style": ["error", "expression", { allowArrowFunctions: true }],
|
|
39
45
|
"no-duplicate-imports": "error",
|
|
@@ -58,21 +64,19 @@ var Neatlint = (options = NeatlintOptionsDefault) => {
|
|
|
58
64
|
options = _.merge({}, NeatlintOptionsDefault, options);
|
|
59
65
|
return [
|
|
60
66
|
{ ignores: options.ignores },
|
|
61
|
-
...TSESLint2.configs.strictTypeChecked,
|
|
62
|
-
...TSESLint2.configs.stylisticTypeChecked,
|
|
63
|
-
ESLintJS.configs.recommended,
|
|
64
67
|
{
|
|
65
|
-
files: options.
|
|
66
|
-
languageOptions: options.
|
|
67
|
-
plugins: options.
|
|
68
|
-
rules: options.
|
|
68
|
+
files: options.typescript?.files,
|
|
69
|
+
languageOptions: options.typescript?.languageOptions,
|
|
70
|
+
plugins: options.typescript?.plugins,
|
|
71
|
+
rules: options.typescript?.rules
|
|
69
72
|
},
|
|
70
73
|
{
|
|
71
|
-
files: options.
|
|
72
|
-
languageOptions: options.
|
|
73
|
-
plugins: options.
|
|
74
|
-
rules: options.
|
|
75
|
-
}
|
|
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 : []
|
|
76
80
|
];
|
|
77
81
|
};
|
|
78
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",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"jiti": "^2.5.1",
|
|
21
21
|
"lodash": "^4.17.21",
|
|
22
22
|
"typescript": "^5.9.2",
|
|
23
|
-
"typescript-eslint": "^8.
|
|
23
|
+
"typescript-eslint": "^8.43.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"prettier": "^3.6.2",
|