@alextheman/eslint-plugin 2.1.0 → 2.2.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/dist/index.cjs +54 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +54 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3715,7 +3715,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
3715
3715
|
|
|
3716
3716
|
// package.json
|
|
3717
3717
|
var name = "@alextheman/eslint-plugin";
|
|
3718
|
-
var version = "2.
|
|
3718
|
+
var version = "2.2.0";
|
|
3719
3719
|
|
|
3720
3720
|
// src/configs/general/javaScriptBase.ts
|
|
3721
3721
|
var import_js = __toESM(require_src(), 1);
|
|
@@ -3878,6 +3878,7 @@ function createPluginBaseConfig(plugin) {
|
|
|
3878
3878
|
rules: {
|
|
3879
3879
|
"@alextheman/no-namespace-imports": "error",
|
|
3880
3880
|
"@alextheman/no-relative-imports": "error",
|
|
3881
|
+
"@alextheman/use-normalized-imports": "error",
|
|
3881
3882
|
"@alextheman/use-object-shorthand": "error"
|
|
3882
3883
|
}
|
|
3883
3884
|
}
|
|
@@ -4463,6 +4464,57 @@ var noSkippedTests = createRule_default({
|
|
|
4463
4464
|
});
|
|
4464
4465
|
var no_skipped_tests_default = noSkippedTests;
|
|
4465
4466
|
|
|
4467
|
+
// src/rules/use-normalized-imports.ts
|
|
4468
|
+
var import_path = __toESM(require("path"), 1);
|
|
4469
|
+
var useNormalizedImports = createRule_default({
|
|
4470
|
+
name: "use-normalized-imports",
|
|
4471
|
+
meta: {
|
|
4472
|
+
docs: {
|
|
4473
|
+
description: "Enforce the usage of normalised imports (i.e. import paths that you would only get from path.posix.normalize())"
|
|
4474
|
+
},
|
|
4475
|
+
messages: {
|
|
4476
|
+
pathNotNormalized: "Import path {{nonNormalized}} is not normalised. Please use {{normalized}} instead."
|
|
4477
|
+
},
|
|
4478
|
+
type: "suggestion",
|
|
4479
|
+
schema: [
|
|
4480
|
+
{
|
|
4481
|
+
type: "object",
|
|
4482
|
+
properties: {
|
|
4483
|
+
fixable: {
|
|
4484
|
+
type: "boolean"
|
|
4485
|
+
}
|
|
4486
|
+
}
|
|
4487
|
+
}
|
|
4488
|
+
],
|
|
4489
|
+
fixable: "code"
|
|
4490
|
+
},
|
|
4491
|
+
defaultOptions: [{ fixable: true }],
|
|
4492
|
+
create(context) {
|
|
4493
|
+
var _a, _b;
|
|
4494
|
+
const isFixable = (_b = (_a = context.options[0]) == null ? void 0 : _a.fixable) != null ? _b : true;
|
|
4495
|
+
return {
|
|
4496
|
+
ImportDeclaration(node) {
|
|
4497
|
+
const normalizedPath = import_path.default.posix.normalize(node.source.value);
|
|
4498
|
+
if (node.source.value !== normalizedPath) {
|
|
4499
|
+
return context.report({
|
|
4500
|
+
node,
|
|
4501
|
+
messageId: "pathNotNormalized",
|
|
4502
|
+
data: {
|
|
4503
|
+
nonNormalized: node.source.value,
|
|
4504
|
+
normalized: normalizedPath
|
|
4505
|
+
},
|
|
4506
|
+
fix: isFixable ? (fixer) => {
|
|
4507
|
+
const [quote] = node.source.raw;
|
|
4508
|
+
return fixer.replaceText(node.source, `${quote}${normalizedPath}${quote}`);
|
|
4509
|
+
} : void 0
|
|
4510
|
+
});
|
|
4511
|
+
}
|
|
4512
|
+
}
|
|
4513
|
+
};
|
|
4514
|
+
}
|
|
4515
|
+
});
|
|
4516
|
+
var use_normalized_imports_default = useNormalizedImports;
|
|
4517
|
+
|
|
4466
4518
|
// src/rules/use-object-shorthand.ts
|
|
4467
4519
|
var import_utils4 = require("@typescript-eslint/utils");
|
|
4468
4520
|
var useObjectShorthand = createRule_default({
|
|
@@ -4509,6 +4561,7 @@ var rules_default = {
|
|
|
4509
4561
|
"no-plugin-configs-access-from-src-configs": no_plugin_configs_access_from_src_configs_default,
|
|
4510
4562
|
"no-relative-imports": no_relative_imports_default,
|
|
4511
4563
|
"no-skipped-tests": no_skipped_tests_default,
|
|
4564
|
+
"use-normalized-imports": use_normalized_imports_default,
|
|
4512
4565
|
"use-object-shorthand": use_object_shorthand_default
|
|
4513
4566
|
};
|
|
4514
4567
|
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3700,7 +3700,7 @@ var require_globals2 = __commonJS({
|
|
|
3700
3700
|
|
|
3701
3701
|
// package.json
|
|
3702
3702
|
var name = "@alextheman/eslint-plugin";
|
|
3703
|
-
var version = "2.
|
|
3703
|
+
var version = "2.2.0";
|
|
3704
3704
|
|
|
3705
3705
|
// src/configs/general/javaScriptBase.ts
|
|
3706
3706
|
var import_js = __toESM(require_src(), 1);
|
|
@@ -3863,6 +3863,7 @@ function createPluginBaseConfig(plugin) {
|
|
|
3863
3863
|
rules: {
|
|
3864
3864
|
"@alextheman/no-namespace-imports": "error",
|
|
3865
3865
|
"@alextheman/no-relative-imports": "error",
|
|
3866
|
+
"@alextheman/use-normalized-imports": "error",
|
|
3866
3867
|
"@alextheman/use-object-shorthand": "error"
|
|
3867
3868
|
}
|
|
3868
3869
|
}
|
|
@@ -4448,6 +4449,57 @@ var noSkippedTests = createRule_default({
|
|
|
4448
4449
|
});
|
|
4449
4450
|
var no_skipped_tests_default = noSkippedTests;
|
|
4450
4451
|
|
|
4452
|
+
// src/rules/use-normalized-imports.ts
|
|
4453
|
+
import path from "path";
|
|
4454
|
+
var useNormalizedImports = createRule_default({
|
|
4455
|
+
name: "use-normalized-imports",
|
|
4456
|
+
meta: {
|
|
4457
|
+
docs: {
|
|
4458
|
+
description: "Enforce the usage of normalised imports (i.e. import paths that you would only get from path.posix.normalize())"
|
|
4459
|
+
},
|
|
4460
|
+
messages: {
|
|
4461
|
+
pathNotNormalized: "Import path {{nonNormalized}} is not normalised. Please use {{normalized}} instead."
|
|
4462
|
+
},
|
|
4463
|
+
type: "suggestion",
|
|
4464
|
+
schema: [
|
|
4465
|
+
{
|
|
4466
|
+
type: "object",
|
|
4467
|
+
properties: {
|
|
4468
|
+
fixable: {
|
|
4469
|
+
type: "boolean"
|
|
4470
|
+
}
|
|
4471
|
+
}
|
|
4472
|
+
}
|
|
4473
|
+
],
|
|
4474
|
+
fixable: "code"
|
|
4475
|
+
},
|
|
4476
|
+
defaultOptions: [{ fixable: true }],
|
|
4477
|
+
create(context) {
|
|
4478
|
+
var _a, _b;
|
|
4479
|
+
const isFixable = (_b = (_a = context.options[0]) == null ? void 0 : _a.fixable) != null ? _b : true;
|
|
4480
|
+
return {
|
|
4481
|
+
ImportDeclaration(node) {
|
|
4482
|
+
const normalizedPath = path.posix.normalize(node.source.value);
|
|
4483
|
+
if (node.source.value !== normalizedPath) {
|
|
4484
|
+
return context.report({
|
|
4485
|
+
node,
|
|
4486
|
+
messageId: "pathNotNormalized",
|
|
4487
|
+
data: {
|
|
4488
|
+
nonNormalized: node.source.value,
|
|
4489
|
+
normalized: normalizedPath
|
|
4490
|
+
},
|
|
4491
|
+
fix: isFixable ? (fixer) => {
|
|
4492
|
+
const [quote] = node.source.raw;
|
|
4493
|
+
return fixer.replaceText(node.source, `${quote}${normalizedPath}${quote}`);
|
|
4494
|
+
} : void 0
|
|
4495
|
+
});
|
|
4496
|
+
}
|
|
4497
|
+
}
|
|
4498
|
+
};
|
|
4499
|
+
}
|
|
4500
|
+
});
|
|
4501
|
+
var use_normalized_imports_default = useNormalizedImports;
|
|
4502
|
+
|
|
4451
4503
|
// src/rules/use-object-shorthand.ts
|
|
4452
4504
|
import { AST_NODE_TYPES as AST_NODE_TYPES3 } from "@typescript-eslint/utils";
|
|
4453
4505
|
var useObjectShorthand = createRule_default({
|
|
@@ -4494,6 +4546,7 @@ var rules_default = {
|
|
|
4494
4546
|
"no-plugin-configs-access-from-src-configs": no_plugin_configs_access_from_src_configs_default,
|
|
4495
4547
|
"no-relative-imports": no_relative_imports_default,
|
|
4496
4548
|
"no-skipped-tests": no_skipped_tests_default,
|
|
4549
|
+
"use-normalized-imports": use_normalized_imports_default,
|
|
4497
4550
|
"use-object-shorthand": use_object_shorthand_default
|
|
4498
4551
|
};
|
|
4499
4552
|
|