@alextheman/eslint-plugin 4.8.5 → 4.9.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 +5 -176
- package/dist/index.cjs +48 -39
- package/dist/index.d.cts +13 -16
- package/dist/index.d.ts +13 -16
- package/dist/index.js +48 -39
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -16,109 +16,19 @@ Since most of the time, you will be using this plugin only to check your code as
|
|
|
16
16
|
npm install --save-peer @alextheman/eslint-plugin
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
## Creating a new rule
|
|
20
|
-
|
|
21
|
-
To add a new rule, you must first create the skeleton structure of your rule, following the given template:
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
24
|
-
const myRule = createRule({
|
|
25
|
-
name: "my-rule",
|
|
26
|
-
meta: {
|
|
27
|
-
docs: {
|
|
28
|
-
description: "Description of the rule",
|
|
29
|
-
},
|
|
30
|
-
messages: {
|
|
31
|
-
message: "Message to be displayed on violation",
|
|
32
|
-
},
|
|
33
|
-
type: "suggestion",
|
|
34
|
-
schema: [],
|
|
35
|
-
},
|
|
36
|
-
defaultOptions: [],
|
|
37
|
-
create(context) {
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export default myRule;
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
The schema may take an array of objects defining what options can be configured. At the very least, these take in a type, but if you specify the type as object, you must also provide the properties. For example:
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
schema: [
|
|
49
|
-
{
|
|
50
|
-
type: "object",
|
|
51
|
-
properties: {
|
|
52
|
-
preference: {
|
|
53
|
-
type: "string",
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
additionalProperties: false,
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Add the rule to `src/rules/index.ts`:
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
|
-
import consistentTestFunction from "src/rules/consistent-test-function";
|
|
65
|
-
import noIsolatedTests from "src/rules/no-isolated-tests";
|
|
66
|
-
import noNamespaceImports from "src/rules/no-namespace-imports";
|
|
67
|
-
// ...
|
|
68
|
-
import myRule from "src/rules/my-rule"
|
|
69
|
-
|
|
70
|
-
export default {
|
|
71
|
-
"consistent-test-function": consistentTestFunction,
|
|
72
|
-
"no-isolated-tests": noIsolatedTests,
|
|
73
|
-
"no-namespace-imports": noNamespaceImports,
|
|
74
|
-
// ...
|
|
75
|
-
"my-rule": myRule
|
|
76
|
-
};
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Next, create the test suite for the rule. You have two choices for which test runner to use - you may either use the `standardRuleTester` or `ruleTesterWithParser`.
|
|
81
|
-
|
|
82
|
-
Use the `ruleTesterWithParser` if you are writing a rule that requires context about the current directory structure. You will then have to specify a filename property for every valid and invalid entry, and it must be a path that exists relative to `tests/fixtures`. Note that we are currently looking into the possibility of using something like tempy to generate a temporary directory per test to run the tests in, but this is not quite ready at the moment so this is the best for now. Feel free to create a pull request if you've come up with something, though.
|
|
83
|
-
|
|
84
|
-
For all other rules, `standardRuleTester` is the best to use.
|
|
85
|
-
|
|
86
|
-
In both cases, you must first pass the rule name, then the actual rule property, then an object containing all valid and invalid cases:
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
standardRuleTester.run("my-rule", rules["my-rule"], {
|
|
90
|
-
valid: [
|
|
91
|
-
{
|
|
92
|
-
code: "Valid code here"
|
|
93
|
-
}
|
|
94
|
-
],
|
|
95
|
-
invalid: [
|
|
96
|
-
{
|
|
97
|
-
code: "Invalid code here",
|
|
98
|
-
errors: {
|
|
99
|
-
messageId: "message",
|
|
100
|
-
data: {
|
|
101
|
-
source: "source"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
]
|
|
106
|
-
})
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Finally, you may create your rule by adding code to the `create(context)` method. Creating an ESLint rule is one of things that is very involved and goes beyond the scope of this README, but you can check out [the ESLint docs](https://eslint.org/docs/latest/extend/custom-rule-tutorial) for more information.
|
|
110
|
-
|
|
111
19
|
## Configs
|
|
112
20
|
### The Config Groups
|
|
113
21
|
|
|
114
|
-
The configs of this plugin are structured in a very particular way. We have our general configs in `src/configs/general`, our plugin configs in `src/configs/plugin`, and our combined configs in `src/configs/combined`. In all three cases, we use the [ESLint flat config style](https://eslint.org/blog/2022/08/new-config-system-part-2/) as that's the most up-to-date config style and allows for more flexibility than just using a package.json or .eslintrc.
|
|
22
|
+
The configs of this plugin are structured in a very particular way. We have our general configs in `src/configs/general`, our plugin configs in `src/configs/plugin`, our personal internal configs in `src/configs/personal`, and our combined configs in `src/configs/combined`. In all three cases, we use the [ESLint flat config style](https://eslint.org/blog/2022/08/new-config-system-part-2/) as that's the most up-to-date config style and allows for more flexibility than just using a package.json or .eslintrc.
|
|
115
23
|
|
|
116
24
|
|
|
117
|
-
The general configs are to be used for defining a ruleset that does NOT rely on the custom plugin rules. They must ONLY use external rules.
|
|
25
|
+
The general configs are to be used for defining a ruleset that does NOT rely on the custom plugin rules. They must ONLY use external rules.
|
|
118
26
|
|
|
119
27
|
The plugin configs are to be used for defining a ruleset that ONLY relies on the custom plugin rules. They must NOT use any external rules. This ensures that, for any users who just want a few recommended configs for only the plugin's rules, they can choose from the ones provided without also having to deal with a bunch of other external rules polluting it as well.
|
|
120
28
|
|
|
121
|
-
|
|
29
|
+
The personal configs are to be used for defining a ruleset to primarily be used in my own projects. They are likely to change according to the needs of my own projects without taking public usage into account and is therefore not recommended to be used outside of my own projects.
|
|
30
|
+
|
|
31
|
+
Lastly, the combined configs may use combinations of both external rules and custom rules. They will most frequently extend configs from any group. It is the most likely one to break on new updates, so I would recommend against using configs from this group in production code and go with one of the other more stable ones (unless you're me and actually control the plugin entirely).
|
|
122
32
|
|
|
123
33
|
### Usage
|
|
124
34
|
|
|
@@ -144,84 +54,3 @@ export default [
|
|
|
144
54
|
}
|
|
145
55
|
]
|
|
146
56
|
```
|
|
147
|
-
|
|
148
|
-
### Adding a config
|
|
149
|
-
|
|
150
|
-
Starting with the general config because that's the easiest - you can create a config file in `src/configs/general` and define a config in the same way you would define any regular ESLint flat config. Again, please make sure you do NOT include any plugin-specific rules.
|
|
151
|
-
|
|
152
|
-
Once you have done this, export it from `src/configs/general/index.ts`, then in `src/alexPlugin.ts`, go to where `alexPlugin.configs`is defined and add the config to the object defined under the `general` property.
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
alexPlugin.configs = createPluginConfigs({
|
|
156
|
-
general: {
|
|
157
|
-
javaScript: javaScriptBase,
|
|
158
|
-
typeScript: typeScriptBase,
|
|
159
|
-
react: reactBase,
|
|
160
|
-
tests: testsBase,
|
|
161
|
-
},
|
|
162
|
-
// ...
|
|
163
|
-
});
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
The `createPluginConfigs` helper will map this to a more standard ESLint naming convention. That is, something like `{ general: { myRuleset } }` will be accessible on the plugin from `plugin.configs["general/my-ruleset"]`.
|
|
167
|
-
|
|
168
|
-
For plugin/combined configs, this is where it gets trickier. These rulesets tend to rely on the usage of the plugin itself, but we also need to define the plugin to be able to use it in configs. As such, the workaround for this is to provide a function that takes in the plugin and returns the config. For example:
|
|
169
|
-
|
|
170
|
-
```typescript
|
|
171
|
-
import type { Linter } from "eslint";
|
|
172
|
-
import type { AlexPlugin } from "src/index";
|
|
173
|
-
|
|
174
|
-
function createPluginBaseConfig(plugin: AlexPlugin): Linter.Config[] {
|
|
175
|
-
return [
|
|
176
|
-
{
|
|
177
|
-
plugins: {
|
|
178
|
-
"@alextheman": plugin,
|
|
179
|
-
},
|
|
180
|
-
rules: {
|
|
181
|
-
"@alextheman/no-namespace-imports": "error",
|
|
182
|
-
"@alextheman/no-relative-imports": "error",
|
|
183
|
-
"@alextheman/use-normalized-imports": "error",
|
|
184
|
-
"@alextheman/use-object-shorthand": "error",
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
];
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export default createPluginBaseConfig;
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
This then gets exported from the relevant folder's `index.ts` file again, and then where we define our configs in `src/alexPlugin.ts`, we invoke the function passing in the plugin.
|
|
194
|
-
|
|
195
|
-
```typescript
|
|
196
|
-
alexPlugin.configs = createPluginConfigs({
|
|
197
|
-
// ...
|
|
198
|
-
plugin: {
|
|
199
|
-
base: createPluginBaseConfig(alexPlugin),
|
|
200
|
-
tests: createPluginTestsBaseConfig(alexPlugin),
|
|
201
|
-
},
|
|
202
|
-
combined: {
|
|
203
|
-
javaScript: createCombinedJavaScriptBaseConfig(alexPlugin),
|
|
204
|
-
typeScript: createCombinedTypeScriptBaseConfig(alexPlugin),
|
|
205
|
-
react: createCombinedReactBaseConfig(alexPlugin),
|
|
206
|
-
tests: createCombinedTestsBaseConfig(alexPlugin),
|
|
207
|
-
typeScriptReact: createCombinedTypeScriptReactBaseConfig(alexPlugin),
|
|
208
|
-
javaScriptReact: createCombinedJavaScriptReactBaseConfig(alexPlugin),
|
|
209
|
-
},
|
|
210
|
-
});
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
Note that this also means that, in config files that provide them using this functional approach, we should NEVER import the plugin directly. This would most likely create circular imports where the plugin ends up calling itself while trying to define itself. Instead, always use the given plugin argument if you want to access the plugin. In the combined configs, if you want to refer to an existing plugin ruleset, it's best to import the function for that ruleset, then call it and pass in the plugin, like so:
|
|
214
|
-
|
|
215
|
-
```typescript
|
|
216
|
-
import type { Linter } from "eslint";
|
|
217
|
-
import type { AlexPlugin } from "src/index";
|
|
218
|
-
|
|
219
|
-
import { typeScriptBase } from "src/configs/general";
|
|
220
|
-
import { createPluginBaseConfig } from "src/configs/plugin";
|
|
221
|
-
|
|
222
|
-
function createCombinedTypeScriptBaseConfig(plugin: AlexPlugin): Linter.Config[] {
|
|
223
|
-
return [...createPluginBaseConfig(plugin), ...typeScriptBase];
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export default createCombinedTypeScriptBaseConfig;
|
|
227
|
-
```
|
package/dist/index.cjs
CHANGED
|
@@ -61,7 +61,7 @@ eslint_plugin_jsdoc = __toESM(eslint_plugin_jsdoc);
|
|
|
61
61
|
|
|
62
62
|
//#region package.json
|
|
63
63
|
var name = "@alextheman/eslint-plugin";
|
|
64
|
-
var version = "4.
|
|
64
|
+
var version = "4.9.0";
|
|
65
65
|
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region node_modules/.pnpm/globals@16.5.0/node_modules/globals/globals.json
|
|
@@ -3662,12 +3662,44 @@ const reactLanguageOptions = {
|
|
|
3662
3662
|
};
|
|
3663
3663
|
var reactLanguageOptions_default = reactLanguageOptions;
|
|
3664
3664
|
|
|
3665
|
+
//#endregion
|
|
3666
|
+
//#region src/configs/helpers/typeScriptLanguageOptions.ts
|
|
3667
|
+
const typeScriptLanguageOptions = {
|
|
3668
|
+
parser: typescript_eslint.default.parser,
|
|
3669
|
+
parserOptions: {
|
|
3670
|
+
ecmaVersion: "latest",
|
|
3671
|
+
projectService: true,
|
|
3672
|
+
sourceType: "module",
|
|
3673
|
+
tsconfigRootDir: process.cwd()
|
|
3674
|
+
}
|
|
3675
|
+
};
|
|
3676
|
+
var typeScriptLanguageOptions_default = typeScriptLanguageOptions;
|
|
3677
|
+
|
|
3678
|
+
//#endregion
|
|
3679
|
+
//#region src/configs/helpers/vitestConfig.ts
|
|
3680
|
+
function vitestConfig(environment = "jsdom") {
|
|
3681
|
+
return (0, vitest_config.defineConfig)({
|
|
3682
|
+
plugins: [(0, vite_tsconfig_paths.default)()],
|
|
3683
|
+
test: {
|
|
3684
|
+
environment,
|
|
3685
|
+
globals: true,
|
|
3686
|
+
include: ["**/tests/**/*.test.ts"]
|
|
3687
|
+
}
|
|
3688
|
+
});
|
|
3689
|
+
}
|
|
3690
|
+
var vitestConfig_default = vitestConfig;
|
|
3691
|
+
|
|
3665
3692
|
//#endregion
|
|
3666
3693
|
//#region src/configs/helpers/sorting/sortExports.ts
|
|
3667
3694
|
const sortExports = {
|
|
3668
3695
|
customGroups: [],
|
|
3669
3696
|
fallbackSort: { type: "natural" },
|
|
3670
|
-
groups: [
|
|
3697
|
+
groups: [
|
|
3698
|
+
"value-export",
|
|
3699
|
+
"wildcard-value-export",
|
|
3700
|
+
"type-export",
|
|
3701
|
+
"wildcard-type-export"
|
|
3702
|
+
],
|
|
3671
3703
|
ignoreCase: true,
|
|
3672
3704
|
newlinesBetween: 1,
|
|
3673
3705
|
order: "asc",
|
|
@@ -3682,11 +3714,12 @@ var sortExports_default = sortExports;
|
|
|
3682
3714
|
//#region src/configs/helpers/sorting/sortImports.ts
|
|
3683
3715
|
const sortImports = {
|
|
3684
3716
|
groups: [
|
|
3685
|
-
"type",
|
|
3686
|
-
"
|
|
3687
|
-
"
|
|
3688
|
-
"
|
|
3689
|
-
"
|
|
3717
|
+
"type-builtin",
|
|
3718
|
+
"type-external",
|
|
3719
|
+
"type-internal",
|
|
3720
|
+
"value-external",
|
|
3721
|
+
"value-builtin",
|
|
3722
|
+
"value-internal"
|
|
3690
3723
|
],
|
|
3691
3724
|
ignoreCase: true,
|
|
3692
3725
|
internalPattern: ["^src/.*"],
|
|
@@ -3703,13 +3736,10 @@ var sortImports_default = sortImports;
|
|
|
3703
3736
|
//#region src/configs/helpers/sorting/sortObjects.ts
|
|
3704
3737
|
const sortObjects = {
|
|
3705
3738
|
customGroups: [],
|
|
3706
|
-
destructuredObjects: true,
|
|
3707
3739
|
fallbackSort: { type: "unsorted" },
|
|
3708
3740
|
groups: [],
|
|
3709
3741
|
ignoreCase: true,
|
|
3710
|
-
ignorePattern: [],
|
|
3711
3742
|
newlinesBetween: "ignore",
|
|
3712
|
-
objectDeclarations: true,
|
|
3713
3743
|
order: "asc",
|
|
3714
3744
|
partitionByComment: false,
|
|
3715
3745
|
partitionByNewLine: false,
|
|
@@ -3720,33 +3750,6 @@ const sortObjects = {
|
|
|
3720
3750
|
};
|
|
3721
3751
|
var sortObjects_default = sortObjects;
|
|
3722
3752
|
|
|
3723
|
-
//#endregion
|
|
3724
|
-
//#region src/configs/helpers/typeScriptLanguageOptions.ts
|
|
3725
|
-
const typeScriptLanguageOptions = {
|
|
3726
|
-
parser: typescript_eslint.default.parser,
|
|
3727
|
-
parserOptions: {
|
|
3728
|
-
ecmaVersion: "latest",
|
|
3729
|
-
projectService: true,
|
|
3730
|
-
sourceType: "module",
|
|
3731
|
-
tsconfigRootDir: process.cwd()
|
|
3732
|
-
}
|
|
3733
|
-
};
|
|
3734
|
-
var typeScriptLanguageOptions_default = typeScriptLanguageOptions;
|
|
3735
|
-
|
|
3736
|
-
//#endregion
|
|
3737
|
-
//#region src/configs/helpers/vitestConfig.ts
|
|
3738
|
-
function vitestConfig(environment = "jsdom") {
|
|
3739
|
-
return (0, vitest_config.defineConfig)({
|
|
3740
|
-
plugins: [(0, vite_tsconfig_paths.default)()],
|
|
3741
|
-
test: {
|
|
3742
|
-
environment,
|
|
3743
|
-
globals: true,
|
|
3744
|
-
include: ["**/tests/**/*.test.ts"]
|
|
3745
|
-
}
|
|
3746
|
-
});
|
|
3747
|
-
}
|
|
3748
|
-
var vitestConfig_default = vitestConfig;
|
|
3749
|
-
|
|
3750
3753
|
//#endregion
|
|
3751
3754
|
//#region src/configs/personal/javaScriptBase.ts
|
|
3752
3755
|
function personalJavaScript(plugin) {
|
|
@@ -4138,8 +4141,14 @@ var typeScript_default$2 = personalTypeScript;
|
|
|
4138
4141
|
//#region src/configs/personal/utility.ts
|
|
4139
4142
|
const personalUtility = [{
|
|
4140
4143
|
name: "@alextheman/personal/utility",
|
|
4141
|
-
plugins: {
|
|
4142
|
-
|
|
4144
|
+
plugins: {
|
|
4145
|
+
"@typescript-eslint": typescript_eslint.default.plugin,
|
|
4146
|
+
jsdoc: eslint_plugin_jsdoc.default
|
|
4147
|
+
},
|
|
4148
|
+
rules: {
|
|
4149
|
+
"@typescript-eslint/explicit-module-boundary-types": "error",
|
|
4150
|
+
"jsdoc/require-jsdoc": ["error", requireJsdocOptions_default]
|
|
4151
|
+
}
|
|
4143
4152
|
}];
|
|
4144
4153
|
var utility_default = personalUtility;
|
|
4145
4154
|
|
package/dist/index.d.cts
CHANGED
|
@@ -50,6 +50,19 @@ declare const prettierRules: Config;
|
|
|
50
50
|
//#region src/configs/helpers/reactLanguageOptions.d.ts
|
|
51
51
|
declare const reactLanguageOptions: Linter.LanguageOptions;
|
|
52
52
|
//#endregion
|
|
53
|
+
//#region src/configs/helpers/typeScriptLanguageOptions.d.ts
|
|
54
|
+
declare const typeScriptLanguageOptions: Linter.LanguageOptions;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/configs/helpers/unusedVarsIgnorePatterns.d.ts
|
|
57
|
+
declare const unusedVarsIgnorePatterns: {
|
|
58
|
+
argsIgnorePattern: string;
|
|
59
|
+
caughtErrorsIgnorePattern: string;
|
|
60
|
+
varsIgnorePattern: string;
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/configs/helpers/vitestConfig.d.ts
|
|
64
|
+
declare function vitestConfig(environment?: VitestEnvironment): vite0.UserConfig;
|
|
65
|
+
//#endregion
|
|
53
66
|
//#region src/configs/helpers/sorting/sortExports.d.ts
|
|
54
67
|
declare const sortExports: {
|
|
55
68
|
customGroups: never[];
|
|
@@ -82,15 +95,12 @@ declare const sortImports: {
|
|
|
82
95
|
//#region src/configs/helpers/sorting/sortObjects.d.ts
|
|
83
96
|
declare const sortObjects: {
|
|
84
97
|
customGroups: never[];
|
|
85
|
-
destructuredObjects: boolean;
|
|
86
98
|
fallbackSort: {
|
|
87
99
|
type: string;
|
|
88
100
|
};
|
|
89
101
|
groups: never[];
|
|
90
102
|
ignoreCase: boolean;
|
|
91
|
-
ignorePattern: never[];
|
|
92
103
|
newlinesBetween: string;
|
|
93
|
-
objectDeclarations: boolean;
|
|
94
104
|
order: string;
|
|
95
105
|
partitionByComment: boolean;
|
|
96
106
|
partitionByNewLine: boolean;
|
|
@@ -100,19 +110,6 @@ declare const sortObjects: {
|
|
|
100
110
|
useConfigurationIf: {};
|
|
101
111
|
};
|
|
102
112
|
//#endregion
|
|
103
|
-
//#region src/configs/helpers/typeScriptLanguageOptions.d.ts
|
|
104
|
-
declare const typeScriptLanguageOptions: Linter.LanguageOptions;
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region src/configs/helpers/unusedVarsIgnorePatterns.d.ts
|
|
107
|
-
declare const unusedVarsIgnorePatterns: {
|
|
108
|
-
argsIgnorePattern: string;
|
|
109
|
-
caughtErrorsIgnorePattern: string;
|
|
110
|
-
varsIgnorePattern: string;
|
|
111
|
-
};
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region src/configs/helpers/vitestConfig.d.ts
|
|
114
|
-
declare function vitestConfig(environment?: VitestEnvironment): vite0.UserConfig;
|
|
115
|
-
//#endregion
|
|
116
113
|
//#region src/configs/helpers/restrictedImports/NoRestrictedImportsOptions.d.ts
|
|
117
114
|
interface RestrictedPathImportBase {
|
|
118
115
|
message: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,19 @@ declare const prettierRules: Config;
|
|
|
50
50
|
//#region src/configs/helpers/reactLanguageOptions.d.ts
|
|
51
51
|
declare const reactLanguageOptions: Linter.LanguageOptions;
|
|
52
52
|
//#endregion
|
|
53
|
+
//#region src/configs/helpers/typeScriptLanguageOptions.d.ts
|
|
54
|
+
declare const typeScriptLanguageOptions: Linter.LanguageOptions;
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/configs/helpers/unusedVarsIgnorePatterns.d.ts
|
|
57
|
+
declare const unusedVarsIgnorePatterns: {
|
|
58
|
+
argsIgnorePattern: string;
|
|
59
|
+
caughtErrorsIgnorePattern: string;
|
|
60
|
+
varsIgnorePattern: string;
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/configs/helpers/vitestConfig.d.ts
|
|
64
|
+
declare function vitestConfig(environment?: VitestEnvironment): vite0.UserConfig;
|
|
65
|
+
//#endregion
|
|
53
66
|
//#region src/configs/helpers/sorting/sortExports.d.ts
|
|
54
67
|
declare const sortExports: {
|
|
55
68
|
customGroups: never[];
|
|
@@ -82,15 +95,12 @@ declare const sortImports: {
|
|
|
82
95
|
//#region src/configs/helpers/sorting/sortObjects.d.ts
|
|
83
96
|
declare const sortObjects: {
|
|
84
97
|
customGroups: never[];
|
|
85
|
-
destructuredObjects: boolean;
|
|
86
98
|
fallbackSort: {
|
|
87
99
|
type: string;
|
|
88
100
|
};
|
|
89
101
|
groups: never[];
|
|
90
102
|
ignoreCase: boolean;
|
|
91
|
-
ignorePattern: never[];
|
|
92
103
|
newlinesBetween: string;
|
|
93
|
-
objectDeclarations: boolean;
|
|
94
104
|
order: string;
|
|
95
105
|
partitionByComment: boolean;
|
|
96
106
|
partitionByNewLine: boolean;
|
|
@@ -100,19 +110,6 @@ declare const sortObjects: {
|
|
|
100
110
|
useConfigurationIf: {};
|
|
101
111
|
};
|
|
102
112
|
//#endregion
|
|
103
|
-
//#region src/configs/helpers/typeScriptLanguageOptions.d.ts
|
|
104
|
-
declare const typeScriptLanguageOptions: Linter.LanguageOptions;
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region src/configs/helpers/unusedVarsIgnorePatterns.d.ts
|
|
107
|
-
declare const unusedVarsIgnorePatterns: {
|
|
108
|
-
argsIgnorePattern: string;
|
|
109
|
-
caughtErrorsIgnorePattern: string;
|
|
110
|
-
varsIgnorePattern: string;
|
|
111
|
-
};
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region src/configs/helpers/vitestConfig.d.ts
|
|
114
|
-
declare function vitestConfig(environment?: VitestEnvironment): vite0.UserConfig;
|
|
115
|
-
//#endregion
|
|
116
113
|
//#region src/configs/helpers/restrictedImports/NoRestrictedImportsOptions.d.ts
|
|
117
114
|
interface RestrictedPathImportBase {
|
|
118
115
|
message: string;
|
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
46
46
|
//#endregion
|
|
47
47
|
//#region package.json
|
|
48
48
|
var name = "@alextheman/eslint-plugin";
|
|
49
|
-
var version = "4.
|
|
49
|
+
var version = "4.9.0";
|
|
50
50
|
|
|
51
51
|
//#endregion
|
|
52
52
|
//#region node_modules/.pnpm/globals@16.5.0/node_modules/globals/globals.json
|
|
@@ -3647,12 +3647,44 @@ const reactLanguageOptions = {
|
|
|
3647
3647
|
};
|
|
3648
3648
|
var reactLanguageOptions_default = reactLanguageOptions;
|
|
3649
3649
|
|
|
3650
|
+
//#endregion
|
|
3651
|
+
//#region src/configs/helpers/typeScriptLanguageOptions.ts
|
|
3652
|
+
const typeScriptLanguageOptions = {
|
|
3653
|
+
parser: tseslint.parser,
|
|
3654
|
+
parserOptions: {
|
|
3655
|
+
ecmaVersion: "latest",
|
|
3656
|
+
projectService: true,
|
|
3657
|
+
sourceType: "module",
|
|
3658
|
+
tsconfigRootDir: process.cwd()
|
|
3659
|
+
}
|
|
3660
|
+
};
|
|
3661
|
+
var typeScriptLanguageOptions_default = typeScriptLanguageOptions;
|
|
3662
|
+
|
|
3663
|
+
//#endregion
|
|
3664
|
+
//#region src/configs/helpers/vitestConfig.ts
|
|
3665
|
+
function vitestConfig(environment = "jsdom") {
|
|
3666
|
+
return defineConfig({
|
|
3667
|
+
plugins: [tsconfigPaths()],
|
|
3668
|
+
test: {
|
|
3669
|
+
environment,
|
|
3670
|
+
globals: true,
|
|
3671
|
+
include: ["**/tests/**/*.test.ts"]
|
|
3672
|
+
}
|
|
3673
|
+
});
|
|
3674
|
+
}
|
|
3675
|
+
var vitestConfig_default = vitestConfig;
|
|
3676
|
+
|
|
3650
3677
|
//#endregion
|
|
3651
3678
|
//#region src/configs/helpers/sorting/sortExports.ts
|
|
3652
3679
|
const sortExports = {
|
|
3653
3680
|
customGroups: [],
|
|
3654
3681
|
fallbackSort: { type: "natural" },
|
|
3655
|
-
groups: [
|
|
3682
|
+
groups: [
|
|
3683
|
+
"value-export",
|
|
3684
|
+
"wildcard-value-export",
|
|
3685
|
+
"type-export",
|
|
3686
|
+
"wildcard-type-export"
|
|
3687
|
+
],
|
|
3656
3688
|
ignoreCase: true,
|
|
3657
3689
|
newlinesBetween: 1,
|
|
3658
3690
|
order: "asc",
|
|
@@ -3667,11 +3699,12 @@ var sortExports_default = sortExports;
|
|
|
3667
3699
|
//#region src/configs/helpers/sorting/sortImports.ts
|
|
3668
3700
|
const sortImports = {
|
|
3669
3701
|
groups: [
|
|
3670
|
-
"type",
|
|
3671
|
-
"
|
|
3672
|
-
"
|
|
3673
|
-
"
|
|
3674
|
-
"
|
|
3702
|
+
"type-builtin",
|
|
3703
|
+
"type-external",
|
|
3704
|
+
"type-internal",
|
|
3705
|
+
"value-external",
|
|
3706
|
+
"value-builtin",
|
|
3707
|
+
"value-internal"
|
|
3675
3708
|
],
|
|
3676
3709
|
ignoreCase: true,
|
|
3677
3710
|
internalPattern: ["^src/.*"],
|
|
@@ -3688,13 +3721,10 @@ var sortImports_default = sortImports;
|
|
|
3688
3721
|
//#region src/configs/helpers/sorting/sortObjects.ts
|
|
3689
3722
|
const sortObjects = {
|
|
3690
3723
|
customGroups: [],
|
|
3691
|
-
destructuredObjects: true,
|
|
3692
3724
|
fallbackSort: { type: "unsorted" },
|
|
3693
3725
|
groups: [],
|
|
3694
3726
|
ignoreCase: true,
|
|
3695
|
-
ignorePattern: [],
|
|
3696
3727
|
newlinesBetween: "ignore",
|
|
3697
|
-
objectDeclarations: true,
|
|
3698
3728
|
order: "asc",
|
|
3699
3729
|
partitionByComment: false,
|
|
3700
3730
|
partitionByNewLine: false,
|
|
@@ -3705,33 +3735,6 @@ const sortObjects = {
|
|
|
3705
3735
|
};
|
|
3706
3736
|
var sortObjects_default = sortObjects;
|
|
3707
3737
|
|
|
3708
|
-
//#endregion
|
|
3709
|
-
//#region src/configs/helpers/typeScriptLanguageOptions.ts
|
|
3710
|
-
const typeScriptLanguageOptions = {
|
|
3711
|
-
parser: tseslint.parser,
|
|
3712
|
-
parserOptions: {
|
|
3713
|
-
ecmaVersion: "latest",
|
|
3714
|
-
projectService: true,
|
|
3715
|
-
sourceType: "module",
|
|
3716
|
-
tsconfigRootDir: process.cwd()
|
|
3717
|
-
}
|
|
3718
|
-
};
|
|
3719
|
-
var typeScriptLanguageOptions_default = typeScriptLanguageOptions;
|
|
3720
|
-
|
|
3721
|
-
//#endregion
|
|
3722
|
-
//#region src/configs/helpers/vitestConfig.ts
|
|
3723
|
-
function vitestConfig(environment = "jsdom") {
|
|
3724
|
-
return defineConfig({
|
|
3725
|
-
plugins: [tsconfigPaths()],
|
|
3726
|
-
test: {
|
|
3727
|
-
environment,
|
|
3728
|
-
globals: true,
|
|
3729
|
-
include: ["**/tests/**/*.test.ts"]
|
|
3730
|
-
}
|
|
3731
|
-
});
|
|
3732
|
-
}
|
|
3733
|
-
var vitestConfig_default = vitestConfig;
|
|
3734
|
-
|
|
3735
3738
|
//#endregion
|
|
3736
3739
|
//#region src/configs/personal/javaScriptBase.ts
|
|
3737
3740
|
function personalJavaScript(plugin) {
|
|
@@ -4123,8 +4126,14 @@ var typeScript_default$2 = personalTypeScript;
|
|
|
4123
4126
|
//#region src/configs/personal/utility.ts
|
|
4124
4127
|
const personalUtility = [{
|
|
4125
4128
|
name: "@alextheman/personal/utility",
|
|
4126
|
-
plugins: {
|
|
4127
|
-
|
|
4129
|
+
plugins: {
|
|
4130
|
+
"@typescript-eslint": tseslint.plugin,
|
|
4131
|
+
jsdoc
|
|
4132
|
+
},
|
|
4133
|
+
rules: {
|
|
4134
|
+
"@typescript-eslint/explicit-module-boundary-types": "error",
|
|
4135
|
+
"jsdoc/require-jsdoc": ["error", requireJsdocOptions_default]
|
|
4136
|
+
}
|
|
4128
4137
|
}];
|
|
4129
4138
|
var utility_default = personalUtility;
|
|
4130
4139
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/eslint-plugin",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "A package to provide custom ESLint rules and configs",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
28
28
|
"@types/node": "^25.0.1",
|
|
29
29
|
"@typescript-eslint/rule-tester": "^8.49.0",
|
|
30
|
+
"alex-c-line": "^1.8.0",
|
|
30
31
|
"dotenv-cli": "^11.0.0",
|
|
31
32
|
"eslint": "^9.39.1",
|
|
32
33
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
"eslint-plugin-jsdoc": "^61.5.0",
|
|
36
37
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
37
38
|
"eslint-plugin-package-json": "^0.85.0",
|
|
38
|
-
"eslint-plugin-perfectionist": "^
|
|
39
|
+
"eslint-plugin-perfectionist": "^5.0.0",
|
|
39
40
|
"eslint-plugin-prettier": "^5.5.4",
|
|
40
41
|
"eslint-plugin-react": "^7.37.5",
|
|
41
42
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
@@ -72,10 +73,10 @@
|
|
|
72
73
|
},
|
|
73
74
|
"scripts": {
|
|
74
75
|
"build": "tsdown",
|
|
75
|
-
"change-major": "pnpm version major -m \"Change version number to v%s\"",
|
|
76
|
-
"change-minor": "pnpm version minor -m \"Change version number to v%s\"",
|
|
77
|
-
"change-patch": "pnpm version patch -m \"Change version number to v%s\"",
|
|
78
76
|
"create-local-package": "pnpm run build && rm -f alextheman-eslint-plugin-*.tgz && pnpm pack",
|
|
77
|
+
"create-release-note-major": "git pull origin main && alex-c-line create-release-note major",
|
|
78
|
+
"create-release-note-minor": "git pull origin main && alex-c-line create-release-note minor",
|
|
79
|
+
"create-release-note-patch": "git pull origin main && alex-c-line create-release-note patch",
|
|
79
80
|
"format": "pnpm run format-prettier && pnpm run format-eslint",
|
|
80
81
|
"format-and-build": "tsx src/utility/checkConfigChanges.ts || pnpm run build && pnpm run format",
|
|
81
82
|
"format-eslint": "eslint --fix --suppress-all \"src/**/*.ts\" \"tests/**/*.ts\" \"package.json\" && rm -f eslint-suppressions.json",
|