@alextheman/eslint-plugin 3.2.1 → 4.0.1
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/dist/index.cjs +26 -31
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +26 -31
- package/package.json +32 -18
package/dist/index.cjs
CHANGED
|
@@ -3771,10 +3771,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
3771
3771
|
|
|
3772
3772
|
// package.json
|
|
3773
3773
|
var name = "@alextheman/eslint-plugin";
|
|
3774
|
-
var version = "
|
|
3775
|
-
|
|
3776
|
-
// src/configs/index.ts
|
|
3777
|
-
var import_eslint_plugin_package_json = __toESM(require("eslint-plugin-package-json"), 1);
|
|
3774
|
+
var version = "4.0.1";
|
|
3778
3775
|
|
|
3779
3776
|
// src/configs/personal/testsBase.ts
|
|
3780
3777
|
var import_globals = __toESM(require_globals2(), 1);
|
|
@@ -4411,6 +4408,21 @@ function createCombinedTypeScriptReactBaseConfig(plugin) {
|
|
|
4411
4408
|
}
|
|
4412
4409
|
var typeScriptReactBase_default = createCombinedTypeScriptReactBaseConfig;
|
|
4413
4410
|
|
|
4411
|
+
// src/configs/general/packageJson.ts
|
|
4412
|
+
var import_eslint_plugin_package_json = __toESM(require("eslint-plugin-package-json"), 1);
|
|
4413
|
+
var packageJsonConfig = [
|
|
4414
|
+
import_eslint_plugin_package_json.default.configs.recommended,
|
|
4415
|
+
{
|
|
4416
|
+
plugins: {
|
|
4417
|
+
"package-json": import_eslint_plugin_package_json.default
|
|
4418
|
+
},
|
|
4419
|
+
rules: {
|
|
4420
|
+
"package-json/scripts-name-casing": "error"
|
|
4421
|
+
}
|
|
4422
|
+
}
|
|
4423
|
+
];
|
|
4424
|
+
var packageJson_default = packageJsonConfig;
|
|
4425
|
+
|
|
4414
4426
|
// src/configs/personal/alexCLine.ts
|
|
4415
4427
|
var import_eslint_plugin_perfectionist3 = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
4416
4428
|
var alexCLineConfig = [
|
|
@@ -4460,21 +4472,16 @@ var createPluginConfigs_default = createPluginConfigs;
|
|
|
4460
4472
|
function createAlexPluginConfigs(plugin) {
|
|
4461
4473
|
return createPluginConfigs_default({
|
|
4462
4474
|
combined: {
|
|
4463
|
-
javaScript: [...javaScriptBase_default3(plugin),
|
|
4464
|
-
javaScriptReact: [
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
],
|
|
4468
|
-
|
|
4469
|
-
tests: [...testsBase_default3(plugin), import_eslint_plugin_package_json.default.configs.recommended],
|
|
4470
|
-
typeScript: [...typeScriptBase_default3(plugin), import_eslint_plugin_package_json.default.configs.recommended],
|
|
4471
|
-
typeScriptReact: [
|
|
4472
|
-
...typeScriptReactBase_default(plugin),
|
|
4473
|
-
import_eslint_plugin_package_json.default.configs.recommended
|
|
4474
|
-
]
|
|
4475
|
+
javaScript: [...javaScriptBase_default3(plugin), ...packageJson_default],
|
|
4476
|
+
javaScriptReact: [...javaScriptReactBase_default(plugin), ...packageJson_default],
|
|
4477
|
+
react: [...reactBase_default3, ...packageJson_default],
|
|
4478
|
+
tests: [...testsBase_default3(plugin), ...packageJson_default],
|
|
4479
|
+
typeScript: [...typeScriptBase_default3(plugin), ...packageJson_default],
|
|
4480
|
+
typeScriptReact: [...typeScriptReactBase_default(plugin), ...packageJson_default]
|
|
4475
4481
|
},
|
|
4476
4482
|
general: {
|
|
4477
4483
|
javaScript: javaScriptBase_default,
|
|
4484
|
+
packageJson: packageJson_default,
|
|
4478
4485
|
react: reactBase_default,
|
|
4479
4486
|
typeScript: typeScriptBase_default
|
|
4480
4487
|
},
|
|
@@ -4975,20 +4982,8 @@ var standardiseErrorMessages = createRule_default({
|
|
|
4975
4982
|
var standardise_error_messages_default = standardiseErrorMessages;
|
|
4976
4983
|
|
|
4977
4984
|
// src/rules/use-normalized-imports.ts
|
|
4985
|
+
var import_utility5 = require("@alextheman/utility");
|
|
4978
4986
|
var import_zod6 = __toESM(require("zod"), 1);
|
|
4979
|
-
|
|
4980
|
-
// src/utility/normalizeImportPath.ts
|
|
4981
|
-
var import_path = __toESM(require("path"), 1);
|
|
4982
|
-
function normalizeImportPath(importPath) {
|
|
4983
|
-
const normalizedPath = import_path.default.posix.normalize(importPath);
|
|
4984
|
-
if (importPath.startsWith("./") && !normalizedPath.startsWith("./")) {
|
|
4985
|
-
return `./${normalizedPath}`;
|
|
4986
|
-
}
|
|
4987
|
-
return normalizedPath;
|
|
4988
|
-
}
|
|
4989
|
-
var normalizeImportPath_default = normalizeImportPath;
|
|
4990
|
-
|
|
4991
|
-
// src/rules/use-normalized-imports.ts
|
|
4992
4987
|
var useNormalizedImportsOptionsSchema = import_zod6.default.object({
|
|
4993
4988
|
fixable: import_zod6.default.boolean()
|
|
4994
4989
|
}).partial();
|
|
@@ -5000,7 +4995,7 @@ var useNormalizedImports = createRule_default({
|
|
|
5000
4995
|
name: "use-normalized-imports",
|
|
5001
4996
|
meta: {
|
|
5002
4997
|
docs: {
|
|
5003
|
-
description: "Enforce the usage of
|
|
4998
|
+
description: "Enforce the usage of normalized imports (i.e. import paths that you would only get from path.posix.normalize())"
|
|
5004
4999
|
},
|
|
5005
5000
|
messages: {
|
|
5006
5001
|
pathNotNormalized: "Import path {{nonNormalized}} is not normalised. Please use {{normalized}} instead."
|
|
@@ -5017,7 +5012,7 @@ var useNormalizedImports = createRule_default({
|
|
|
5017
5012
|
);
|
|
5018
5013
|
return {
|
|
5019
5014
|
ImportDeclaration(node) {
|
|
5020
|
-
const normalizedPath =
|
|
5015
|
+
const normalizedPath = (0, import_utility5.normalizeImportPath)(node.source.value);
|
|
5021
5016
|
if (node.source.value !== normalizedPath) {
|
|
5022
5017
|
return context.report({
|
|
5023
5018
|
node,
|
package/dist/index.d.cts
CHANGED
|
@@ -6,11 +6,11 @@ import { RuleFixer, RuleFix, RuleContext } from '@typescript-eslint/utils/ts-esl
|
|
|
6
6
|
import { TSESTree } from '@typescript-eslint/utils';
|
|
7
7
|
|
|
8
8
|
var name = "@alextheman/eslint-plugin";
|
|
9
|
-
var version = "
|
|
9
|
+
var version = "4.0.1";
|
|
10
10
|
|
|
11
11
|
type CamelToKebab<S extends string> = S extends `${IgnoreCase<"J">}avaScript${infer Rest}` ? Rest extends "" ? "javascript" : `javascript${CamelToKebab<Rest>}` : S extends `${IgnoreCase<"T">}ypeScript${infer Rest}` ? Rest extends "" ? "typescript" : `typescript${CamelToKebab<Rest>}` : S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${CamelToKebab<Tail>}` : `-${Lowercase<Head>}${CamelToKebab<Tail>}` : S;
|
|
12
12
|
|
|
13
|
-
type GeneralConfig = "javaScript" | "typeScript" | "react";
|
|
13
|
+
type GeneralConfig = "javaScript" | "typeScript" | "react" | "packageJson";
|
|
14
14
|
type PluginConfig = "base" | "tests";
|
|
15
15
|
type PersonalConfig = "javaScript" | "typeScript" | "react" | "tests" | "eslintPlugin" | "neurosongsBackEnd" | "neurosongsFrontEnd" | "utility" | "alexCLine";
|
|
16
16
|
type CombinedConfig = "javaScript" | "typeScript" | "react" | "tests" | "typeScriptReact" | "javaScriptReact";
|
package/dist/index.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ import { RuleFixer, RuleFix, RuleContext } from '@typescript-eslint/utils/ts-esl
|
|
|
6
6
|
import { TSESTree } from '@typescript-eslint/utils';
|
|
7
7
|
|
|
8
8
|
var name = "@alextheman/eslint-plugin";
|
|
9
|
-
var version = "
|
|
9
|
+
var version = "4.0.1";
|
|
10
10
|
|
|
11
11
|
type CamelToKebab<S extends string> = S extends `${IgnoreCase<"J">}avaScript${infer Rest}` ? Rest extends "" ? "javascript" : `javascript${CamelToKebab<Rest>}` : S extends `${IgnoreCase<"T">}ypeScript${infer Rest}` ? Rest extends "" ? "typescript" : `typescript${CamelToKebab<Rest>}` : S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${CamelToKebab<Tail>}` : `-${Lowercase<Head>}${CamelToKebab<Tail>}` : S;
|
|
12
12
|
|
|
13
|
-
type GeneralConfig = "javaScript" | "typeScript" | "react";
|
|
13
|
+
type GeneralConfig = "javaScript" | "typeScript" | "react" | "packageJson";
|
|
14
14
|
type PluginConfig = "base" | "tests";
|
|
15
15
|
type PersonalConfig = "javaScript" | "typeScript" | "react" | "tests" | "eslintPlugin" | "neurosongsBackEnd" | "neurosongsFrontEnd" | "utility" | "alexCLine";
|
|
16
16
|
type CombinedConfig = "javaScript" | "typeScript" | "react" | "tests" | "typeScriptReact" | "javaScriptReact";
|
package/dist/index.js
CHANGED
|
@@ -3744,10 +3744,7 @@ var require_src = __commonJS({
|
|
|
3744
3744
|
|
|
3745
3745
|
// package.json
|
|
3746
3746
|
var name = "@alextheman/eslint-plugin";
|
|
3747
|
-
var version = "
|
|
3748
|
-
|
|
3749
|
-
// src/configs/index.ts
|
|
3750
|
-
import packageJson from "eslint-plugin-package-json";
|
|
3747
|
+
var version = "4.0.1";
|
|
3751
3748
|
|
|
3752
3749
|
// src/configs/personal/testsBase.ts
|
|
3753
3750
|
var import_globals = __toESM(require_globals2(), 1);
|
|
@@ -4384,6 +4381,21 @@ function createCombinedTypeScriptReactBaseConfig(plugin) {
|
|
|
4384
4381
|
}
|
|
4385
4382
|
var typeScriptReactBase_default = createCombinedTypeScriptReactBaseConfig;
|
|
4386
4383
|
|
|
4384
|
+
// src/configs/general/packageJson.ts
|
|
4385
|
+
import packageJson from "eslint-plugin-package-json";
|
|
4386
|
+
var packageJsonConfig = [
|
|
4387
|
+
packageJson.configs.recommended,
|
|
4388
|
+
{
|
|
4389
|
+
plugins: {
|
|
4390
|
+
"package-json": packageJson
|
|
4391
|
+
},
|
|
4392
|
+
rules: {
|
|
4393
|
+
"package-json/scripts-name-casing": "error"
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4396
|
+
];
|
|
4397
|
+
var packageJson_default = packageJsonConfig;
|
|
4398
|
+
|
|
4387
4399
|
// src/configs/personal/alexCLine.ts
|
|
4388
4400
|
import perfectionist3 from "eslint-plugin-perfectionist";
|
|
4389
4401
|
var alexCLineConfig = [
|
|
@@ -4433,21 +4445,16 @@ var createPluginConfigs_default = createPluginConfigs;
|
|
|
4433
4445
|
function createAlexPluginConfigs(plugin) {
|
|
4434
4446
|
return createPluginConfigs_default({
|
|
4435
4447
|
combined: {
|
|
4436
|
-
javaScript: [...javaScriptBase_default3(plugin),
|
|
4437
|
-
javaScriptReact: [
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
],
|
|
4441
|
-
|
|
4442
|
-
tests: [...testsBase_default3(plugin), packageJson.configs.recommended],
|
|
4443
|
-
typeScript: [...typeScriptBase_default3(plugin), packageJson.configs.recommended],
|
|
4444
|
-
typeScriptReact: [
|
|
4445
|
-
...typeScriptReactBase_default(plugin),
|
|
4446
|
-
packageJson.configs.recommended
|
|
4447
|
-
]
|
|
4448
|
+
javaScript: [...javaScriptBase_default3(plugin), ...packageJson_default],
|
|
4449
|
+
javaScriptReact: [...javaScriptReactBase_default(plugin), ...packageJson_default],
|
|
4450
|
+
react: [...reactBase_default3, ...packageJson_default],
|
|
4451
|
+
tests: [...testsBase_default3(plugin), ...packageJson_default],
|
|
4452
|
+
typeScript: [...typeScriptBase_default3(plugin), ...packageJson_default],
|
|
4453
|
+
typeScriptReact: [...typeScriptReactBase_default(plugin), ...packageJson_default]
|
|
4448
4454
|
},
|
|
4449
4455
|
general: {
|
|
4450
4456
|
javaScript: javaScriptBase_default,
|
|
4457
|
+
packageJson: packageJson_default,
|
|
4451
4458
|
react: reactBase_default,
|
|
4452
4459
|
typeScript: typeScriptBase_default
|
|
4453
4460
|
},
|
|
@@ -4948,20 +4955,8 @@ var standardiseErrorMessages = createRule_default({
|
|
|
4948
4955
|
var standardise_error_messages_default = standardiseErrorMessages;
|
|
4949
4956
|
|
|
4950
4957
|
// src/rules/use-normalized-imports.ts
|
|
4958
|
+
import { normalizeImportPath } from "@alextheman/utility";
|
|
4951
4959
|
import z6 from "zod";
|
|
4952
|
-
|
|
4953
|
-
// src/utility/normalizeImportPath.ts
|
|
4954
|
-
import path from "path";
|
|
4955
|
-
function normalizeImportPath(importPath) {
|
|
4956
|
-
const normalizedPath = path.posix.normalize(importPath);
|
|
4957
|
-
if (importPath.startsWith("./") && !normalizedPath.startsWith("./")) {
|
|
4958
|
-
return `./${normalizedPath}`;
|
|
4959
|
-
}
|
|
4960
|
-
return normalizedPath;
|
|
4961
|
-
}
|
|
4962
|
-
var normalizeImportPath_default = normalizeImportPath;
|
|
4963
|
-
|
|
4964
|
-
// src/rules/use-normalized-imports.ts
|
|
4965
4960
|
var useNormalizedImportsOptionsSchema = z6.object({
|
|
4966
4961
|
fixable: z6.boolean()
|
|
4967
4962
|
}).partial();
|
|
@@ -4973,7 +4968,7 @@ var useNormalizedImports = createRule_default({
|
|
|
4973
4968
|
name: "use-normalized-imports",
|
|
4974
4969
|
meta: {
|
|
4975
4970
|
docs: {
|
|
4976
|
-
description: "Enforce the usage of
|
|
4971
|
+
description: "Enforce the usage of normalized imports (i.e. import paths that you would only get from path.posix.normalize())"
|
|
4977
4972
|
},
|
|
4978
4973
|
messages: {
|
|
4979
4974
|
pathNotNormalized: "Import path {{nonNormalized}} is not normalised. Please use {{normalized}} instead."
|
|
@@ -4990,7 +4985,7 @@ var useNormalizedImports = createRule_default({
|
|
|
4990
4985
|
);
|
|
4991
4986
|
return {
|
|
4992
4987
|
ImportDeclaration(node) {
|
|
4993
|
-
const normalizedPath =
|
|
4988
|
+
const normalizedPath = normalizeImportPath(node.source.value);
|
|
4994
4989
|
if (node.source.value !== normalizedPath) {
|
|
4995
4990
|
return context.report({
|
|
4996
4991
|
node,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/eslint-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "A package to provide custom ESLint rules and configs",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,12 +20,14 @@
|
|
|
20
20
|
"change-minor": "npm version minor -m \"Change version number to v%s\"",
|
|
21
21
|
"change-patch": "npm version patch -m \"Change version number to v%s\"",
|
|
22
22
|
"create-local-package": "npm run build && rm -f alextheman-eslint-plugin-*.tgz && npm pack",
|
|
23
|
-
"format": "
|
|
23
|
+
"format": "npm run format-prettier && npm run format-eslint",
|
|
24
|
+
"format-and-build": "tsx src/utility/checkConfigChanges.ts || npm run build && npm run format",
|
|
24
25
|
"format-eslint": "eslint --fix --suppress-all \"src/**/*.ts\" \"tests/**/*.ts\" \"package.json\" && rm -f eslint-suppressions.json",
|
|
25
26
|
"format-prettier": "npm run format-prettier-typescript && npm run format-prettier-javascript",
|
|
26
27
|
"format-prettier-javascript": "prettier --write \"./**/*.js\"",
|
|
27
28
|
"format-prettier-typescript": "prettier --write --parser typescript \"./**/*.ts\"",
|
|
28
|
-
"lint": "
|
|
29
|
+
"lint": "npm run lint-tsc && npm run lint-eslint && npm run lint-prettier",
|
|
30
|
+
"lint-and-build": "tsx src/utility/checkConfigChanges.ts || npm run build && npm run lint",
|
|
29
31
|
"lint-eslint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" \"package.json\"",
|
|
30
32
|
"lint-prettier": "npm run lint-prettier-typescript && npm run lint-prettier-javascript",
|
|
31
33
|
"lint-prettier-javascript": "prettier --check \"./**/*.js\"",
|
|
@@ -38,8 +40,8 @@
|
|
|
38
40
|
"update-peer-dependencies": "bash -c 'npx npm-check-updates --dep peer -u \"$@\" && npm install' --"
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
41
|
-
"@alextheman/utility": "^2.
|
|
42
|
-
"@typescript-eslint/utils": "^8.
|
|
43
|
+
"@alextheman/utility": "^2.20.0",
|
|
44
|
+
"@typescript-eslint/utils": "^8.47.0",
|
|
43
45
|
"common-tags": "^1.8.2",
|
|
44
46
|
"zod": "^4.1.12"
|
|
45
47
|
},
|
|
@@ -48,28 +50,40 @@
|
|
|
48
50
|
"@types/eslint": "^9.6.1",
|
|
49
51
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
50
52
|
"@types/node": "^24.10.1",
|
|
51
|
-
"@typescript-eslint/rule-tester": "^8.
|
|
52
|
-
"globals": "^16.5.0",
|
|
53
|
-
"husky": "^9.1.7",
|
|
54
|
-
"prettier": "^3.6.2",
|
|
55
|
-
"tsup": "^8.5.1",
|
|
56
|
-
"tsx": "^4.20.6",
|
|
57
|
-
"typescript": "^5.9.3",
|
|
58
|
-
"vite-tsconfig-paths": "^5.1.4",
|
|
59
|
-
"vitest": "^4.0.9"
|
|
60
|
-
},
|
|
61
|
-
"peerDependencies": {
|
|
53
|
+
"@typescript-eslint/rule-tester": "^8.47.0",
|
|
62
54
|
"eslint": "^9.39.1",
|
|
63
55
|
"eslint-config-prettier": "^10.1.8",
|
|
64
56
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
65
57
|
"eslint-plugin-import": "^2.32.0",
|
|
66
58
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
67
|
-
"eslint-plugin-package-json": "^0.
|
|
59
|
+
"eslint-plugin-package-json": "^0.85.0",
|
|
68
60
|
"eslint-plugin-perfectionist": "^4.15.1",
|
|
69
61
|
"eslint-plugin-prettier": "^5.5.4",
|
|
70
62
|
"eslint-plugin-react": "^7.37.5",
|
|
71
63
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
72
64
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
73
|
-
"
|
|
65
|
+
"globals": "^16.5.0",
|
|
66
|
+
"husky": "^9.1.7",
|
|
67
|
+
"prettier": "^3.6.2",
|
|
68
|
+
"tsup": "^8.5.1",
|
|
69
|
+
"tsx": "^4.20.6",
|
|
70
|
+
"typescript": "^5.9.3",
|
|
71
|
+
"typescript-eslint": "^8.47.0",
|
|
72
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
73
|
+
"vitest": "^4.0.13"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"eslint": ">=9.0.0",
|
|
77
|
+
"eslint-config-prettier": ">=10.0.0",
|
|
78
|
+
"eslint-import-resolver-typescript": ">=4.0.0",
|
|
79
|
+
"eslint-plugin-import": ">=2.0.0",
|
|
80
|
+
"eslint-plugin-jsx-a11y": ">=6.0.0",
|
|
81
|
+
"eslint-plugin-package-json": ">=0.85.0",
|
|
82
|
+
"eslint-plugin-perfectionist": ">=4.0.0",
|
|
83
|
+
"eslint-plugin-prettier": ">=5.0.0",
|
|
84
|
+
"eslint-plugin-react": ">=7.0.0",
|
|
85
|
+
"eslint-plugin-react-hooks": ">=7.0.0",
|
|
86
|
+
"eslint-plugin-react-refresh": ">=0.4.0",
|
|
87
|
+
"typescript-eslint": ">=8.0.0"
|
|
74
88
|
}
|
|
75
89
|
}
|