@alextheman/eslint-plugin 3.1.2 → 3.1.4
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 +23 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +23 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3765,7 +3765,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
3765
3765
|
|
|
3766
3766
|
// package.json
|
|
3767
3767
|
var name = "@alextheman/eslint-plugin";
|
|
3768
|
-
var version = "3.1.
|
|
3768
|
+
var version = "3.1.4";
|
|
3769
3769
|
|
|
3770
3770
|
// src/configs/index.ts
|
|
3771
3771
|
var import_eslint_plugin_package_json = __toESM(require("eslint-plugin-package-json"), 1);
|
|
@@ -3993,6 +3993,14 @@ function createPersonalJavaScriptBaseConfig(plugin) {
|
|
|
3993
3993
|
"prettier/prettier": ["warn", prettierRules_default],
|
|
3994
3994
|
"sort-vars": "error"
|
|
3995
3995
|
}
|
|
3996
|
+
},
|
|
3997
|
+
{
|
|
3998
|
+
files: ["src/**/index.{js,jsx,ts,tsx}"],
|
|
3999
|
+
rules: {
|
|
4000
|
+
// Since index files generally tend to export files from the same folder, they tend to be more coupled with their location in the folder,
|
|
4001
|
+
// so it feels more natural to allow only root-level relative imports from an index file.
|
|
4002
|
+
"@alextheman/no-relative-imports": ["error", { depth: 0 }]
|
|
4003
|
+
}
|
|
3996
4004
|
}
|
|
3997
4005
|
];
|
|
3998
4006
|
}
|
|
@@ -4961,8 +4969,20 @@ var standardiseErrorMessages = createRule_default({
|
|
|
4961
4969
|
var standardise_error_messages_default = standardiseErrorMessages;
|
|
4962
4970
|
|
|
4963
4971
|
// src/rules/use-normalized-imports.ts
|
|
4964
|
-
var import_path = __toESM(require("path"), 1);
|
|
4965
4972
|
var import_zod6 = __toESM(require("zod"), 1);
|
|
4973
|
+
|
|
4974
|
+
// src/utility/normalizeImportPath.ts
|
|
4975
|
+
var import_path = __toESM(require("path"), 1);
|
|
4976
|
+
function normalizeImportPath(importPath) {
|
|
4977
|
+
const normalizedPath = import_path.default.posix.normalize(importPath);
|
|
4978
|
+
if (importPath.startsWith("./") && !normalizedPath.startsWith("./")) {
|
|
4979
|
+
return `./${normalizedPath}`;
|
|
4980
|
+
}
|
|
4981
|
+
return normalizedPath;
|
|
4982
|
+
}
|
|
4983
|
+
var normalizeImportPath_default = normalizeImportPath;
|
|
4984
|
+
|
|
4985
|
+
// src/rules/use-normalized-imports.ts
|
|
4966
4986
|
var useNormalizedImportsOptionsSchema = import_zod6.default.object({
|
|
4967
4987
|
fixable: import_zod6.default.boolean()
|
|
4968
4988
|
}).partial();
|
|
@@ -4991,7 +5011,7 @@ var useNormalizedImports = createRule_default({
|
|
|
4991
5011
|
);
|
|
4992
5012
|
return {
|
|
4993
5013
|
ImportDeclaration(node) {
|
|
4994
|
-
const normalizedPath =
|
|
5014
|
+
const normalizedPath = normalizeImportPath_default(node.source.value);
|
|
4995
5015
|
if (node.source.value !== normalizedPath) {
|
|
4996
5016
|
return context.report({
|
|
4997
5017
|
node,
|
package/dist/index.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import { Config } from 'prettier';
|
|
|
4
4
|
import z from 'zod';
|
|
5
5
|
|
|
6
6
|
var name = "@alextheman/eslint-plugin";
|
|
7
|
-
var version = "3.1.
|
|
7
|
+
var version = "3.1.4";
|
|
8
8
|
|
|
9
9
|
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;
|
|
10
10
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Config } from 'prettier';
|
|
|
4
4
|
import z from 'zod';
|
|
5
5
|
|
|
6
6
|
var name = "@alextheman/eslint-plugin";
|
|
7
|
-
var version = "3.1.
|
|
7
|
+
var version = "3.1.4";
|
|
8
8
|
|
|
9
9
|
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;
|
|
10
10
|
|
package/dist/index.js
CHANGED
|
@@ -3744,7 +3744,7 @@ var require_src = __commonJS({
|
|
|
3744
3744
|
|
|
3745
3745
|
// package.json
|
|
3746
3746
|
var name = "@alextheman/eslint-plugin";
|
|
3747
|
-
var version = "3.1.
|
|
3747
|
+
var version = "3.1.4";
|
|
3748
3748
|
|
|
3749
3749
|
// src/configs/index.ts
|
|
3750
3750
|
import packageJson from "eslint-plugin-package-json";
|
|
@@ -3972,6 +3972,14 @@ function createPersonalJavaScriptBaseConfig(plugin) {
|
|
|
3972
3972
|
"prettier/prettier": ["warn", prettierRules_default],
|
|
3973
3973
|
"sort-vars": "error"
|
|
3974
3974
|
}
|
|
3975
|
+
},
|
|
3976
|
+
{
|
|
3977
|
+
files: ["src/**/index.{js,jsx,ts,tsx}"],
|
|
3978
|
+
rules: {
|
|
3979
|
+
// Since index files generally tend to export files from the same folder, they tend to be more coupled with their location in the folder,
|
|
3980
|
+
// so it feels more natural to allow only root-level relative imports from an index file.
|
|
3981
|
+
"@alextheman/no-relative-imports": ["error", { depth: 0 }]
|
|
3982
|
+
}
|
|
3975
3983
|
}
|
|
3976
3984
|
];
|
|
3977
3985
|
}
|
|
@@ -4940,8 +4948,20 @@ var standardiseErrorMessages = createRule_default({
|
|
|
4940
4948
|
var standardise_error_messages_default = standardiseErrorMessages;
|
|
4941
4949
|
|
|
4942
4950
|
// src/rules/use-normalized-imports.ts
|
|
4943
|
-
import path from "path";
|
|
4944
4951
|
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
|
|
4945
4965
|
var useNormalizedImportsOptionsSchema = z6.object({
|
|
4946
4966
|
fixable: z6.boolean()
|
|
4947
4967
|
}).partial();
|
|
@@ -4970,7 +4990,7 @@ var useNormalizedImports = createRule_default({
|
|
|
4970
4990
|
);
|
|
4971
4991
|
return {
|
|
4972
4992
|
ImportDeclaration(node) {
|
|
4973
|
-
const normalizedPath =
|
|
4993
|
+
const normalizedPath = normalizeImportPath_default(node.source.value);
|
|
4974
4994
|
if (node.source.value !== normalizedPath) {
|
|
4975
4995
|
return context.report({
|
|
4976
4996
|
node,
|