@conarti/eslint-plugin-feature-sliced 1.0.3 → 1.0.5
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/CHANGELOG.md +36 -18
- package/README.md +132 -142
- package/dist/config.js +27 -27
- package/dist/configs/import-order/index.js +20 -20
- package/dist/configs/import-order/recommended.js +28 -28
- package/dist/configs/import-order/with-newlines-and-type-group.js +28 -28
- package/dist/configs/import-order/with-newlines.js +28 -28
- package/dist/configs/import-order/with-type-group.js +28 -28
- package/dist/configs/recommended.js +11 -11
- package/dist/configs/rules.js +11 -11
- package/dist/index.js +24 -24
- package/dist/lib/{fsd-lib → feature-sliced}/extract-feature-sliced-parts.js +18 -18
- package/dist/lib/{fsd-lib → feature-sliced}/extract-layer.js +21 -21
- package/dist/lib/{fsd-lib → feature-sliced}/extract-paths-info.js +59 -59
- package/dist/lib/{fsd-lib → feature-sliced}/extract-segment.js +18 -18
- package/dist/lib/{fsd-lib → feature-sliced}/extract-slice.js +10 -10
- package/dist/lib/{fsd-lib → feature-sliced}/index.js +10 -10
- package/dist/lib/{fsd-lib → feature-sliced}/layers.js +16 -16
- package/dist/lib/{fsd-lib → feature-sliced}/validate-extracted-feature-sliced-parts.js +29 -29
- package/dist/lib/{path-lib → path}/convert-to-absolute.js +18 -18
- package/dist/lib/{path-lib → path}/index.js +9 -9
- package/dist/lib/{path-lib → path}/is-path-relative.js +7 -7
- package/dist/lib/{path-lib → path}/join-path.js +12 -12
- package/dist/lib/{path-lib → path}/normalize-path.js +19 -19
- package/dist/lib/{rule-lib → rule}/create-rule.js +7 -7
- package/dist/lib/{rule-lib → rule}/extract-current-file-path.js +11 -11
- package/dist/lib/{rule-lib → rule}/extract-cwd.js +13 -13
- package/dist/lib/{rule-lib → rule}/extract-node-path.js +13 -13
- package/dist/lib/rule/extract-paths.js +21 -0
- package/dist/lib/{rule-lib → rule}/extract-rule-options.js +7 -7
- package/dist/lib/{rule-lib → rule}/get-source-range-without-quotes.js +7 -7
- package/dist/lib/{rule-lib/can-validate.js → rule/has-path.js} +11 -11
- package/dist/lib/{rule-lib → rule}/index.js +27 -23
- package/dist/lib/{rule-lib → rule}/is-ignored-current-file.js +12 -12
- package/dist/lib/rule/is-ignored-target.js +12 -0
- package/dist/lib/{rule-lib → rule}/is-ignored.js +12 -12
- package/dist/lib/rule/is-node-type.js +16 -0
- package/dist/lib/{rule-lib → rule}/models.js +2 -2
- package/dist/lib/shared/get-by-reg-exp.js +12 -12
- package/dist/lib/shared/index.js +11 -11
- package/dist/lib/shared/is-null.js +7 -7
- package/dist/lib/shared/is-object.js +7 -7
- package/dist/lib/shared/is-undefined.js +7 -7
- package/dist/rules/absolute-relative/config.js +2 -2
- package/dist/rules/absolute-relative/index.js +51 -52
- package/dist/rules/absolute-relative/model/{errors-lib.js → errors.js} +17 -17
- package/dist/rules/absolute-relative/model/index.js +5 -5
- package/dist/rules/absolute-relative/model/should-be-absolute.js +16 -16
- package/dist/rules/absolute-relative/model/should-be-relative.js +21 -21
- package/dist/rules/absolute-relative/model/validate-and-report.js +24 -24
- package/dist/rules/layers-slices/config.js +2 -2
- package/dist/rules/layers-slices/index.js +55 -56
- package/dist/rules/layers-slices/model/{errors-lib.js → errors.js} +22 -14
- package/dist/rules/layers-slices/model/index.js +5 -5
- package/dist/rules/layers-slices/model/is-not-suitable-for-validation.js +17 -0
- package/dist/rules/layers-slices/model/specifiers/extract-import-specifiers.js +8 -0
- package/dist/rules/layers-slices/model/specifiers/has-errors-at-all-specifiers.js +9 -0
- package/dist/rules/layers-slices/model/specifiers/index.js +7 -0
- package/dist/rules/layers-slices/model/specifiers/validate-specifiers.js +8 -0
- package/dist/rules/layers-slices/model/validate-and-report.js +46 -22
- package/dist/rules/layers-slices/model/validate-node/index.js +16 -0
- package/dist/rules/layers-slices/model/validate-node/valid-by-layer-order.js +10 -0
- package/dist/rules/layers-slices/model/validate-node/valid-by-type-import.js +9 -0
- package/dist/rules/public-api/config.js +2 -2
- package/dist/rules/public-api/index.js +65 -65
- package/dist/rules/public-api/model/convert-to-public-api.js +24 -24
- package/dist/rules/public-api/model/{errors-lib.js → errors.js} +34 -34
- package/dist/rules/public-api/model/index.js +5 -5
- package/dist/rules/public-api/model/is-index-file.js +7 -7
- package/dist/rules/public-api/model/is-layer-public-api.js +23 -23
- package/dist/rules/public-api/model/is-segments-public-api.js +11 -11
- package/dist/rules/public-api/model/is-slice-public-api.js +7 -7
- package/dist/rules/public-api/model/should-be-from-public-api.js +21 -21
- package/dist/rules/public-api/model/validate-and-report-program.js +15 -15
- package/dist/rules/public-api/model/validate-and-report.js +18 -18
- package/package.json +15 -14
- package/dist/lib/fsd-lib/extract-paths.js +0 -19
- package/dist/lib/rule-lib/is-node-type.js +0 -17
- package/dist/rules/layers-slices/model/can-import-layer.js +0 -22
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.normalizePath = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const config_1 = require("../../config");
|
|
9
|
-
function normalizePath(targetPath) {
|
|
10
|
-
const winSepRegExp = /\\/g;
|
|
11
|
-
const withNormalizedSeparators = path_1.default
|
|
12
|
-
.normalize(targetPath)
|
|
13
|
-
.replace(winSepRegExp, config_1.pathSeparator);
|
|
14
|
-
if (targetPath.startsWith('./')) {
|
|
15
|
-
return `./${withNormalizedSeparators}`;
|
|
16
|
-
}
|
|
17
|
-
return withNormalizedSeparators;
|
|
18
|
-
}
|
|
19
|
-
exports.normalizePath = normalizePath;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.normalizePath = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const config_1 = require("../../config");
|
|
9
|
+
function normalizePath(targetPath) {
|
|
10
|
+
const winSepRegExp = /\\/g;
|
|
11
|
+
const withNormalizedSeparators = path_1.default
|
|
12
|
+
.normalize(targetPath)
|
|
13
|
+
.replace(winSepRegExp, config_1.pathSeparator);
|
|
14
|
+
if (targetPath.startsWith('./')) {
|
|
15
|
+
return `./${withNormalizedSeparators}`;
|
|
16
|
+
}
|
|
17
|
+
return withNormalizedSeparators;
|
|
18
|
+
}
|
|
19
|
+
exports.normalizePath = normalizePath;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRule = void 0;
|
|
4
|
-
const url_1 = require("url");
|
|
5
|
-
const utils_1 = require("@typescript-eslint/utils");
|
|
6
|
-
const config_1 = require("../../config");
|
|
7
|
-
exports.createRule = utils_1.ESLintUtils.RuleCreator((name) => new url_1.URL(name, config_1.RULE_DOCS_URL).toString());
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRule = void 0;
|
|
4
|
+
const url_1 = require("url");
|
|
5
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
6
|
+
const config_1 = require("../../config");
|
|
7
|
+
exports.createRule = utils_1.ESLintUtils.RuleCreator((name) => new url_1.URL(name, config_1.RULE_DOCS_URL).toString());
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractCurrentFilePath = void 0;
|
|
4
|
-
const
|
|
5
|
-
function extractCurrentFilePath(context) {
|
|
6
|
-
const currentFilePath = context.getPhysicalFilename
|
|
7
|
-
? context.getPhysicalFilename()
|
|
8
|
-
: context.getFilename();
|
|
9
|
-
return (0,
|
|
10
|
-
}
|
|
11
|
-
exports.extractCurrentFilePath = extractCurrentFilePath;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractCurrentFilePath = void 0;
|
|
4
|
+
const path_1 = require("../path");
|
|
5
|
+
function extractCurrentFilePath(context) {
|
|
6
|
+
const currentFilePath = context.getPhysicalFilename
|
|
7
|
+
? context.getPhysicalFilename()
|
|
8
|
+
: context.getFilename();
|
|
9
|
+
return (0, path_1.normalizePath)(currentFilePath);
|
|
10
|
+
}
|
|
11
|
+
exports.extractCurrentFilePath = extractCurrentFilePath;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractCwd = void 0;
|
|
4
|
-
const
|
|
5
|
-
const shared_1 = require("../shared");
|
|
6
|
-
function extractCwd(context) {
|
|
7
|
-
const cwd = context.getCwd?.();
|
|
8
|
-
if ((0, shared_1.isUndefined)(cwd)) {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
return (0,
|
|
12
|
-
}
|
|
13
|
-
exports.extractCwd = extractCwd;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractCwd = void 0;
|
|
4
|
+
const path_1 = require("../path");
|
|
5
|
+
const shared_1 = require("../shared");
|
|
6
|
+
function extractCwd(context) {
|
|
7
|
+
const cwd = context.getCwd?.();
|
|
8
|
+
if ((0, shared_1.isUndefined)(cwd)) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return (0, path_1.normalizePath)(cwd);
|
|
12
|
+
}
|
|
13
|
+
exports.extractCwd = extractCwd;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractNodePath = void 0;
|
|
4
|
-
const
|
|
5
|
-
function extractNodePath(node) {
|
|
6
|
-
const targetPath = node.source.value;
|
|
7
|
-
const normalizedTargetPath = (0,
|
|
8
|
-
return {
|
|
9
|
-
targetPath,
|
|
10
|
-
normalizedTargetPath,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
exports.extractNodePath = extractNodePath;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractNodePath = void 0;
|
|
4
|
+
const path_1 = require("../path");
|
|
5
|
+
function extractNodePath(node) {
|
|
6
|
+
const targetPath = node.source.value;
|
|
7
|
+
const normalizedTargetPath = (0, path_1.normalizePath)(targetPath);
|
|
8
|
+
return {
|
|
9
|
+
targetPath,
|
|
10
|
+
normalizedTargetPath,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.extractNodePath = extractNodePath;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractPaths = void 0;
|
|
4
|
+
const path_1 = require("../path");
|
|
5
|
+
const extract_current_file_path_1 = require("./extract-current-file-path");
|
|
6
|
+
const extract_cwd_1 = require("./extract-cwd");
|
|
7
|
+
const extract_node_path_1 = require("./extract-node-path");
|
|
8
|
+
function extractPaths(node, context) {
|
|
9
|
+
const normalizedCurrentFilePath = (0, extract_current_file_path_1.extractCurrentFilePath)(context);
|
|
10
|
+
const { targetPath, normalizedTargetPath, } = (0, extract_node_path_1.extractNodePath)(node);
|
|
11
|
+
const absoluteTargetPath = (0, path_1.convertToAbsolute)(normalizedCurrentFilePath, normalizedTargetPath);
|
|
12
|
+
const cwd = (0, extract_cwd_1.extractCwd)(context);
|
|
13
|
+
return {
|
|
14
|
+
targetPath,
|
|
15
|
+
normalizedTargetPath,
|
|
16
|
+
normalizedCurrentFilePath,
|
|
17
|
+
absoluteTargetPath,
|
|
18
|
+
normalizedCwd: cwd,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
exports.extractPaths = extractPaths;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extractRuleOptions = void 0;
|
|
4
|
-
function extractRuleOptions(optionsWithDefault) {
|
|
5
|
-
return optionsWithDefault[0];
|
|
6
|
-
}
|
|
7
|
-
exports.extractRuleOptions = extractRuleOptions;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractRuleOptions = void 0;
|
|
4
|
+
function extractRuleOptions(optionsWithDefault) {
|
|
5
|
+
return optionsWithDefault[0];
|
|
6
|
+
}
|
|
7
|
+
exports.extractRuleOptions = extractRuleOptions;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSourceRangeWithoutQuotes = void 0;
|
|
4
|
-
function getSourceRangeWithoutQuotes([rangeStart, rangeEnd]) {
|
|
5
|
-
return [rangeStart + 1, rangeEnd - 1];
|
|
6
|
-
}
|
|
7
|
-
exports.getSourceRangeWithoutQuotes = getSourceRangeWithoutQuotes;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSourceRangeWithoutQuotes = void 0;
|
|
4
|
+
function getSourceRangeWithoutQuotes([rangeStart, rangeEnd]) {
|
|
5
|
+
return [rangeStart + 1, rangeEnd - 1];
|
|
6
|
+
}
|
|
7
|
+
exports.getSourceRangeWithoutQuotes = getSourceRangeWithoutQuotes;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const shared_1 = require("../shared");
|
|
5
|
-
function
|
|
6
|
-
if ((0, shared_1.isObject)(node) && 'source' in node) {
|
|
7
|
-
return node.source !== null;
|
|
8
|
-
}
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
exports.
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasPath = void 0;
|
|
4
|
+
const shared_1 = require("../shared");
|
|
5
|
+
function hasPath(node) {
|
|
6
|
+
if ((0, shared_1.isObject)(node) && 'source' in node) {
|
|
7
|
+
return node.source !== null;
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
exports.hasPath = hasPath;
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isIgnoredCurrentFile = exports.extractCwd = exports.extractCurrentFilePath = exports.extractNodePath = exports.isNodeType = exports.createRule = exports.isIgnored = exports.getSourceRangeWithoutQuotes = exports.
|
|
4
|
-
var extract_rule_options_1 = require("./extract-rule-options");
|
|
5
|
-
Object.defineProperty(exports, "extractRuleOptions", { enumerable: true, get: function () { return extract_rule_options_1.extractRuleOptions; } });
|
|
6
|
-
var
|
|
7
|
-
Object.defineProperty(exports, "
|
|
8
|
-
var get_source_range_without_quotes_1 = require("./get-source-range-without-quotes");
|
|
9
|
-
Object.defineProperty(exports, "getSourceRangeWithoutQuotes", { enumerable: true, get: function () { return get_source_range_without_quotes_1.getSourceRangeWithoutQuotes; } });
|
|
10
|
-
var is_ignored_1 = require("./is-ignored");
|
|
11
|
-
Object.defineProperty(exports, "isIgnored", { enumerable: true, get: function () { return is_ignored_1.isIgnored; } });
|
|
12
|
-
var create_rule_1 = require("./create-rule");
|
|
13
|
-
Object.defineProperty(exports, "createRule", { enumerable: true, get: function () { return create_rule_1.createRule; } });
|
|
14
|
-
var is_node_type_1 = require("./is-node-type");
|
|
15
|
-
Object.defineProperty(exports, "isNodeType", { enumerable: true, get: function () { return is_node_type_1.isNodeType; } });
|
|
16
|
-
var extract_node_path_1 = require("./extract-node-path");
|
|
17
|
-
Object.defineProperty(exports, "extractNodePath", { enumerable: true, get: function () { return extract_node_path_1.extractNodePath; } });
|
|
18
|
-
var extract_current_file_path_1 = require("./extract-current-file-path");
|
|
19
|
-
Object.defineProperty(exports, "extractCurrentFilePath", { enumerable: true, get: function () { return extract_current_file_path_1.extractCurrentFilePath; } });
|
|
20
|
-
var extract_cwd_1 = require("./extract-cwd");
|
|
21
|
-
Object.defineProperty(exports, "extractCwd", { enumerable: true, get: function () { return extract_cwd_1.extractCwd; } });
|
|
22
|
-
var is_ignored_current_file_1 = require("./is-ignored-current-file");
|
|
23
|
-
Object.defineProperty(exports, "isIgnoredCurrentFile", { enumerable: true, get: function () { return is_ignored_current_file_1.isIgnoredCurrentFile; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractPaths = exports.isIgnoredTarget = exports.isIgnoredCurrentFile = exports.extractCwd = exports.extractCurrentFilePath = exports.extractNodePath = exports.isNodeType = exports.createRule = exports.isIgnored = exports.getSourceRangeWithoutQuotes = exports.hasPath = exports.extractRuleOptions = void 0;
|
|
4
|
+
var extract_rule_options_1 = require("./extract-rule-options");
|
|
5
|
+
Object.defineProperty(exports, "extractRuleOptions", { enumerable: true, get: function () { return extract_rule_options_1.extractRuleOptions; } });
|
|
6
|
+
var has_path_1 = require("./has-path");
|
|
7
|
+
Object.defineProperty(exports, "hasPath", { enumerable: true, get: function () { return has_path_1.hasPath; } });
|
|
8
|
+
var get_source_range_without_quotes_1 = require("./get-source-range-without-quotes");
|
|
9
|
+
Object.defineProperty(exports, "getSourceRangeWithoutQuotes", { enumerable: true, get: function () { return get_source_range_without_quotes_1.getSourceRangeWithoutQuotes; } });
|
|
10
|
+
var is_ignored_1 = require("./is-ignored");
|
|
11
|
+
Object.defineProperty(exports, "isIgnored", { enumerable: true, get: function () { return is_ignored_1.isIgnored; } });
|
|
12
|
+
var create_rule_1 = require("./create-rule");
|
|
13
|
+
Object.defineProperty(exports, "createRule", { enumerable: true, get: function () { return create_rule_1.createRule; } });
|
|
14
|
+
var is_node_type_1 = require("./is-node-type");
|
|
15
|
+
Object.defineProperty(exports, "isNodeType", { enumerable: true, get: function () { return is_node_type_1.isNodeType; } });
|
|
16
|
+
var extract_node_path_1 = require("./extract-node-path");
|
|
17
|
+
Object.defineProperty(exports, "extractNodePath", { enumerable: true, get: function () { return extract_node_path_1.extractNodePath; } });
|
|
18
|
+
var extract_current_file_path_1 = require("./extract-current-file-path");
|
|
19
|
+
Object.defineProperty(exports, "extractCurrentFilePath", { enumerable: true, get: function () { return extract_current_file_path_1.extractCurrentFilePath; } });
|
|
20
|
+
var extract_cwd_1 = require("./extract-cwd");
|
|
21
|
+
Object.defineProperty(exports, "extractCwd", { enumerable: true, get: function () { return extract_cwd_1.extractCwd; } });
|
|
22
|
+
var is_ignored_current_file_1 = require("./is-ignored-current-file");
|
|
23
|
+
Object.defineProperty(exports, "isIgnoredCurrentFile", { enumerable: true, get: function () { return is_ignored_current_file_1.isIgnoredCurrentFile; } });
|
|
24
|
+
var is_ignored_target_1 = require("./is-ignored-target");
|
|
25
|
+
Object.defineProperty(exports, "isIgnoredTarget", { enumerable: true, get: function () { return is_ignored_target_1.isIgnoredTarget; } });
|
|
26
|
+
var extract_paths_1 = require("./extract-paths");
|
|
27
|
+
Object.defineProperty(exports, "extractPaths", { enumerable: true, get: function () { return extract_paths_1.extractPaths; } });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isIgnoredCurrentFile = void 0;
|
|
4
|
-
const extract_current_file_path_1 = require("./extract-current-file-path");
|
|
5
|
-
const extract_rule_options_1 = require("./extract-rule-options");
|
|
6
|
-
const is_ignored_1 = require("./is-ignored");
|
|
7
|
-
function isIgnoredCurrentFile(context, optionsWithDefault) {
|
|
8
|
-
const ruleOptions = (0, extract_rule_options_1.extractRuleOptions)(optionsWithDefault);
|
|
9
|
-
const normalizedCurrentFilePath = (0, extract_current_file_path_1.extractCurrentFilePath)(context);
|
|
10
|
-
return (0, is_ignored_1.isIgnored)(normalizedCurrentFilePath, ruleOptions.ignoreInFilesPatterns);
|
|
11
|
-
}
|
|
12
|
-
exports.isIgnoredCurrentFile = isIgnoredCurrentFile;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isIgnoredCurrentFile = void 0;
|
|
4
|
+
const extract_current_file_path_1 = require("./extract-current-file-path");
|
|
5
|
+
const extract_rule_options_1 = require("./extract-rule-options");
|
|
6
|
+
const is_ignored_1 = require("./is-ignored");
|
|
7
|
+
function isIgnoredCurrentFile(context, optionsWithDefault) {
|
|
8
|
+
const ruleOptions = (0, extract_rule_options_1.extractRuleOptions)(optionsWithDefault);
|
|
9
|
+
const normalizedCurrentFilePath = (0, extract_current_file_path_1.extractCurrentFilePath)(context);
|
|
10
|
+
return (0, is_ignored_1.isIgnored)(normalizedCurrentFilePath, ruleOptions.ignoreInFilesPatterns);
|
|
11
|
+
}
|
|
12
|
+
exports.isIgnoredCurrentFile = isIgnoredCurrentFile;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isIgnoredTarget = void 0;
|
|
4
|
+
const extract_node_path_1 = require("./extract-node-path");
|
|
5
|
+
const extract_rule_options_1 = require("./extract-rule-options");
|
|
6
|
+
const is_ignored_1 = require("./is-ignored");
|
|
7
|
+
function isIgnoredTarget(node, optionsWithDefault) {
|
|
8
|
+
const { targetPath } = (0, extract_node_path_1.extractNodePath)(node);
|
|
9
|
+
const userDefinedRuleOptions = (0, extract_rule_options_1.extractRuleOptions)(optionsWithDefault);
|
|
10
|
+
return (0, is_ignored_1.isIgnored)(targetPath, userDefinedRuleOptions.ignorePatterns);
|
|
11
|
+
}
|
|
12
|
+
exports.isIgnoredTarget = isIgnoredTarget;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isIgnored = void 0;
|
|
7
|
-
const picomatch_1 = __importDefault(require("picomatch"));
|
|
8
|
-
function isIgnored(path, patterns) {
|
|
9
|
-
const match = (0, picomatch_1.default)(patterns);
|
|
10
|
-
return match(path);
|
|
11
|
-
}
|
|
12
|
-
exports.isIgnored = isIgnored;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isIgnored = void 0;
|
|
7
|
+
const picomatch_1 = __importDefault(require("picomatch"));
|
|
8
|
+
function isIgnored(path, patterns) {
|
|
9
|
+
const match = (0, picomatch_1.default)(patterns);
|
|
10
|
+
return match(path);
|
|
11
|
+
}
|
|
12
|
+
exports.isIgnored = isIgnored;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNodeType = void 0;
|
|
4
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
+
function isNodeType(node) {
|
|
6
|
+
const isImport = utils_1.ASTUtils.isNodeOfTypes([utils_1.AST_NODE_TYPES.ImportSpecifier, utils_1.AST_NODE_TYPES.ImportDeclaration])(node);
|
|
7
|
+
const isExport = utils_1.ASTUtils.isNodeOfTypes([utils_1.AST_NODE_TYPES.ExportAllDeclaration, utils_1.AST_NODE_TYPES.ExportNamedDeclaration])(node);
|
|
8
|
+
if (isImport) {
|
|
9
|
+
return node.importKind === 'type';
|
|
10
|
+
}
|
|
11
|
+
if (isExport) {
|
|
12
|
+
return node.exportKind === 'type';
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
exports.isNodeType = isNodeType;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getByRegExp = void 0;
|
|
4
|
-
function getByRegExp(target, regExp, fromEnd = false) {
|
|
5
|
-
const results = target.match(regExp) || [];
|
|
6
|
-
if (fromEnd) {
|
|
7
|
-
const lastResult = results[results.length - 1];
|
|
8
|
-
return lastResult || null;
|
|
9
|
-
}
|
|
10
|
-
return results[0] || null;
|
|
11
|
-
}
|
|
12
|
-
exports.getByRegExp = getByRegExp;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getByRegExp = void 0;
|
|
4
|
+
function getByRegExp(target, regExp, fromEnd = false) {
|
|
5
|
+
const results = target.match(regExp) || [];
|
|
6
|
+
if (fromEnd) {
|
|
7
|
+
const lastResult = results[results.length - 1];
|
|
8
|
+
return lastResult || null;
|
|
9
|
+
}
|
|
10
|
+
return results[0] || null;
|
|
11
|
+
}
|
|
12
|
+
exports.getByRegExp = getByRegExp;
|
package/dist/lib/shared/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUndefined = exports.isNull = exports.isObject = exports.getByRegExp = void 0;
|
|
4
|
-
var get_by_reg_exp_1 = require("./get-by-reg-exp");
|
|
5
|
-
Object.defineProperty(exports, "getByRegExp", { enumerable: true, get: function () { return get_by_reg_exp_1.getByRegExp; } });
|
|
6
|
-
var is_object_1 = require("./is-object");
|
|
7
|
-
Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return is_object_1.isObject; } });
|
|
8
|
-
var is_null_1 = require("./is-null");
|
|
9
|
-
Object.defineProperty(exports, "isNull", { enumerable: true, get: function () { return is_null_1.isNull; } });
|
|
10
|
-
var is_undefined_1 = require("./is-undefined");
|
|
11
|
-
Object.defineProperty(exports, "isUndefined", { enumerable: true, get: function () { return is_undefined_1.isUndefined; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isUndefined = exports.isNull = exports.isObject = exports.getByRegExp = void 0;
|
|
4
|
+
var get_by_reg_exp_1 = require("./get-by-reg-exp");
|
|
5
|
+
Object.defineProperty(exports, "getByRegExp", { enumerable: true, get: function () { return get_by_reg_exp_1.getByRegExp; } });
|
|
6
|
+
var is_object_1 = require("./is-object");
|
|
7
|
+
Object.defineProperty(exports, "isObject", { enumerable: true, get: function () { return is_object_1.isObject; } });
|
|
8
|
+
var is_null_1 = require("./is-null");
|
|
9
|
+
Object.defineProperty(exports, "isNull", { enumerable: true, get: function () { return is_null_1.isNull; } });
|
|
10
|
+
var is_undefined_1 = require("./is-undefined");
|
|
11
|
+
Object.defineProperty(exports, "isUndefined", { enumerable: true, get: function () { return is_undefined_1.isUndefined; } });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNull = void 0;
|
|
4
|
-
function isNull(target) {
|
|
5
|
-
return target === null;
|
|
6
|
-
}
|
|
7
|
-
exports.isNull = isNull;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isNull = void 0;
|
|
4
|
+
function isNull(target) {
|
|
5
|
+
return target === null;
|
|
6
|
+
}
|
|
7
|
+
exports.isNull = isNull;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isObject = void 0;
|
|
4
|
-
function isObject(target) {
|
|
5
|
-
return (typeof target === 'object' || typeof target === 'function') && (target !== null);
|
|
6
|
-
}
|
|
7
|
-
exports.isObject = isObject;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isObject = void 0;
|
|
4
|
+
function isObject(target) {
|
|
5
|
+
return (typeof target === 'object' || typeof target === 'function') && (target !== null);
|
|
6
|
+
}
|
|
7
|
+
exports.isObject = isObject;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUndefined = void 0;
|
|
4
|
-
function isUndefined(target) {
|
|
5
|
-
return target === undefined;
|
|
6
|
-
}
|
|
7
|
-
exports.isUndefined = isUndefined;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isUndefined = void 0;
|
|
4
|
+
function isUndefined(target) {
|
|
5
|
+
return target === undefined;
|
|
6
|
+
}
|
|
7
|
+
exports.isUndefined = isUndefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,52 +1,51 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const model_1 = require("./model");
|
|
5
|
-
exports.default = (0,
|
|
6
|
-
name: 'absolute-relative',
|
|
7
|
-
meta: {
|
|
8
|
-
type: 'problem',
|
|
9
|
-
docs: {
|
|
10
|
-
description: 'Checks for absolute and relative paths',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
["must-be-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const rule_1 = require("../../lib/rule");
|
|
4
|
+
const model_1 = require("./model");
|
|
5
|
+
exports.default = (0, rule_1.createRule)({
|
|
6
|
+
name: 'absolute-relative',
|
|
7
|
+
meta: {
|
|
8
|
+
type: 'problem',
|
|
9
|
+
docs: {
|
|
10
|
+
description: 'Checks for absolute and relative paths',
|
|
11
|
+
},
|
|
12
|
+
messages: {
|
|
13
|
+
["must-be-relative-path"]: 'There must be relative paths',
|
|
14
|
+
["must-be-absolute-path"]: 'There must be absolute paths',
|
|
15
|
+
},
|
|
16
|
+
schema: [
|
|
17
|
+
{
|
|
18
|
+
type: 'object',
|
|
19
|
+
properties: {
|
|
20
|
+
ignoreInFilesPatterns: {
|
|
21
|
+
type: 'array',
|
|
22
|
+
items: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
defaultOptions: [
|
|
31
|
+
{
|
|
32
|
+
ignoreInFilesPatterns: [],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
create(context, optionsWithDefault) {
|
|
36
|
+
return {
|
|
37
|
+
ImportDeclaration(node) {
|
|
38
|
+
(0, model_1.validateAndReport)(node, context, optionsWithDefault);
|
|
39
|
+
},
|
|
40
|
+
ImportExpression(node) {
|
|
41
|
+
(0, model_1.validateAndReport)(node, context, optionsWithDefault);
|
|
42
|
+
},
|
|
43
|
+
ExportAllDeclaration(node) {
|
|
44
|
+
(0, model_1.validateAndReport)(node, context, optionsWithDefault, { needCheckForAbsolute: false });
|
|
45
|
+
},
|
|
46
|
+
ExportNamedDeclaration(node) {
|
|
47
|
+
(0, model_1.validateAndReport)(node, context, optionsWithDefault, { needCheckForAbsolute: false });
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reportShouldBeAbsolute = exports.reportShouldBeRelative = void 0;
|
|
4
|
-
function reportShouldBeRelative(node, context) {
|
|
5
|
-
context.report({
|
|
6
|
-
node: node.source,
|
|
7
|
-
messageId: "must-be-relative-path",
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
exports.reportShouldBeRelative = reportShouldBeRelative;
|
|
11
|
-
function reportShouldBeAbsolute(node, context) {
|
|
12
|
-
context.report({
|
|
13
|
-
node: node.source,
|
|
14
|
-
messageId: "must-be-absolute-path",
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
exports.reportShouldBeAbsolute = reportShouldBeAbsolute;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reportShouldBeAbsolute = exports.reportShouldBeRelative = void 0;
|
|
4
|
+
function reportShouldBeRelative(node, context) {
|
|
5
|
+
context.report({
|
|
6
|
+
node: node.source,
|
|
7
|
+
messageId: "must-be-relative-path",
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
exports.reportShouldBeRelative = reportShouldBeRelative;
|
|
11
|
+
function reportShouldBeAbsolute(node, context) {
|
|
12
|
+
context.report({
|
|
13
|
+
node: node.source,
|
|
14
|
+
messageId: "must-be-absolute-path",
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.reportShouldBeAbsolute = reportShouldBeAbsolute;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateAndReport = void 0;
|
|
4
|
-
var validate_and_report_1 = require("./validate-and-report");
|
|
5
|
-
Object.defineProperty(exports, "validateAndReport", { enumerable: true, get: function () { return validate_and_report_1.validateAndReport; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateAndReport = void 0;
|
|
4
|
+
var validate_and_report_1 = require("./validate-and-report");
|
|
5
|
+
Object.defineProperty(exports, "validateAndReport", { enumerable: true, get: function () { return validate_and_report_1.validateAndReport; } });
|