@alexlit/lint-kit 167.2.0 → 167.4.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/package.json +1 -1
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/LICENSE +21 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/README.md +54 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/configs/base.d.ts +23 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/configs/base.js +25 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/configs/flat/base.d.ts +35 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/configs/flat/base.js +35 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/configs/flat/recommended.d.ts +1194 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/configs/flat/recommended.js +39 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/configs/recommended.d.ts +29 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/configs/recommended.js +29 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/index.d.ts +2532 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/index.js +62 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/key-format-style.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/key-format-style.js +247 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-i18n-component.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-i18n-component.js +85 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-i18n-place-attr.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-i18n-place-attr.js +41 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-i18n-places-prop.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-i18n-places-prop.js +36 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-modulo-syntax.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-modulo-syntax.js +94 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-tc.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-tc.js +42 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-v-t.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-deprecated-v-t.js +33 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-duplicate-keys-in-locale.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-duplicate-keys-in-locale.js +271 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-dynamic-keys.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-dynamic-keys.js +105 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-html-messages.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-html-messages.js +137 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-i18n-t-path-prop.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-i18n-t-path-prop.js +44 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-missing-keys-in-other-locales.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-missing-keys-in-other-locales.js +264 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-missing-keys.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-missing-keys.js +111 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-raw-text.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-raw-text.js +575 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-unknown-locale.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-unknown-locale.js +198 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-unused-keys.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-unused-keys.js +456 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-v-html.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/no-v-html.js +50 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/prefer-linked-key-with-paren.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/prefer-linked-key-with-paren.js +108 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/prefer-sfc-lang-attr.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/prefer-sfc-lang-attr.js +58 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/sfc-locale-attr.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/sfc-locale-attr.js +65 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/valid-message-syntax.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/rules/valid-message-syntax.js +186 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/eslint.d.ts +216 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/eslint.js +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/i18n.d.ts +5 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/i18n.js +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/index.d.ts +6 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/index.js +22 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/nodes.d.ts +7 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/nodes.js +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/settings.d.ts +8 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/settings.js +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/types.d.ts +38 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/types.js +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/vue-parser-services.d.ts +32 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/types/vue-parser-services.js +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/cache-function.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/cache-function.js +11 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/cache-loader.d.ts +10 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/cache-loader.js +27 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/casing.d.ts +10 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/casing.js +101 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/collect-keys.d.ts +13 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/collect-keys.js +160 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/collect-linked-keys.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/collect-linked-keys.js +49 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/compat.d.ts +3 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/compat.js +35 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/default-timeouts.d.ts +6 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/default-timeouts.js +10 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/get-cwd.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/get-cwd.js +9 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/glob-utils.d.ts +15 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/glob-utils.js +154 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/ignored-paths.d.ts +43 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/ignored-paths.js +234 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/index.d.ts +25 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/index.js +446 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/key-path.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/key-path.js +27 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/locale-messages.d.ts +54 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/locale-messages.js +187 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/message-compiler/parser-v9.d.ts +8 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/message-compiler/parser-v9.js +40 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/message-compiler/parser.d.ts +5 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/message-compiler/parser.js +18 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/message-compiler/traverser.d.ts +6 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/message-compiler/traverser.js +31 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/message-compiler/utils.d.ts +28 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/message-compiler/utils.js +279 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/build-parser-using-flat-config.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/build-parser-using-flat-config.js +11 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/build-parser-using-legacy-config.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/build-parser-using-legacy-config.js +46 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/index.d.ts +4 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/index.js +18 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/parse-by-parser.d.ts +3 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/parse-by-parser.js +42 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/should-use-flat-config.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/should-use-flat-config.js +54 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/worker.d.ts +1 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parser-config-resolver/worker.js +32 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parsers/index.d.ts +4 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/parsers/index.js +32 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/path-utils.d.ts +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/path-utils.js +21 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/regexp.d.ts +1 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/regexp.js +16 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/resource-loader.d.ts +10 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/resource-loader.js +32 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/rule.d.ts +9 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/rule.js +75 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/node_modules/globals/globals.json +3345 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/node_modules/globals/index.d.ts +3452 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/node_modules/globals/index.js +2 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/node_modules/globals/license +9 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/node_modules/globals/package.json +117 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/node_modules/globals/readme.md +42 -0
- package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/package.json +147 -0
- package/packages/config-eslint/node_modules/vue-eslint-parser/LICENSE +21 -0
- package/packages/config-eslint/node_modules/vue-eslint-parser/README.md +332 -0
- package/packages/config-eslint/node_modules/vue-eslint-parser/index.d.ts +667 -0
- package/packages/config-eslint/node_modules/vue-eslint-parser/index.js +6642 -0
- package/packages/config-eslint/node_modules/vue-eslint-parser/index.js.map +1 -0
- package/packages/config-eslint/node_modules/vue-eslint-parser/package.json +100 -0
- package/packages/config-eslint/package.json +5 -5
- package/packages/config-eslint/plugins/unicorn.js +2 -0
- package/packages/config-prettier/package.json +3 -3
- package/packages/config-stylelint/package.json +3 -3
|
@@ -0,0 +1,160 @@
|
|
|
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.usedKeysCache = exports.collectKeysFromAST = void 0;
|
|
7
|
+
const vue_eslint_parser_1 = require("vue-eslint-parser");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const glob_utils_1 = require("./glob-utils");
|
|
10
|
+
const resource_loader_1 = require("./resource-loader");
|
|
11
|
+
const cache_loader_1 = require("./cache-loader");
|
|
12
|
+
const cache_function_1 = require("./cache-function");
|
|
13
|
+
const debug_1 = __importDefault(require("debug"));
|
|
14
|
+
const get_cwd_1 = require("./get-cwd");
|
|
15
|
+
const index_1 = require("./index");
|
|
16
|
+
const parser_config_resolver_1 = require("./parser-config-resolver");
|
|
17
|
+
const debug = (0, debug_1.default)('eslint-plugin-vue-i18n:collect-keys');
|
|
18
|
+
function getKeyFromCallExpression(node) {
|
|
19
|
+
const funcName = (node.callee.type === 'MemberExpression' &&
|
|
20
|
+
node.callee.property.type === 'Identifier' &&
|
|
21
|
+
node.callee.property.name) ||
|
|
22
|
+
(node.callee.type === 'Identifier' && node.callee.name) ||
|
|
23
|
+
'';
|
|
24
|
+
if (!/^(\$t|t|\$tc|tc)$/.test(funcName) ||
|
|
25
|
+
!node.arguments ||
|
|
26
|
+
!node.arguments.length) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const [keyNode] = node.arguments;
|
|
30
|
+
if (!(0, index_1.isStaticLiteral)(keyNode)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return (0, index_1.getStaticLiteralValue)(keyNode);
|
|
34
|
+
}
|
|
35
|
+
function getKeyFromVDirective(node) {
|
|
36
|
+
if (node.value &&
|
|
37
|
+
node.value.type === 'VExpressionContainer' &&
|
|
38
|
+
(0, index_1.isStaticLiteral)(node.value.expression)) {
|
|
39
|
+
return (0, index_1.getStaticLiteralValue)(node.value.expression);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function getKeyFromI18nComponent(node) {
|
|
46
|
+
if (node.value && node.value.type === 'VLiteral') {
|
|
47
|
+
return node.value.value;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function collectKeysFromText(filename, parser) {
|
|
54
|
+
const effectiveFilename = filename || '<text>';
|
|
55
|
+
debug(`collectKeysFromFile ${effectiveFilename}`);
|
|
56
|
+
try {
|
|
57
|
+
const parseResult = parser(filename);
|
|
58
|
+
if (!parseResult) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
return collectKeysFromAST(parseResult.ast, parseResult.visitorKeys);
|
|
62
|
+
}
|
|
63
|
+
catch (_e) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function collectKeyResourcesFromFiles(fileNames, cwd) {
|
|
68
|
+
debug('collectKeysFromFiles', fileNames);
|
|
69
|
+
const parser = (0, parser_config_resolver_1.buildParserFromConfig)(cwd);
|
|
70
|
+
const results = [];
|
|
71
|
+
for (const filename of fileNames) {
|
|
72
|
+
debug(`Processing file ... ${filename}`);
|
|
73
|
+
results.push(new resource_loader_1.ResourceLoader((0, path_1.resolve)(filename), () => {
|
|
74
|
+
return collectKeysFromText(filename, parser);
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
return results;
|
|
78
|
+
}
|
|
79
|
+
function collectKeysFromAST(node, visitorKeys) {
|
|
80
|
+
debug('collectKeysFromAST');
|
|
81
|
+
const results = new Set();
|
|
82
|
+
function enterNode(node) {
|
|
83
|
+
if (node.type === 'VAttribute') {
|
|
84
|
+
if (node.directive) {
|
|
85
|
+
if (node.key.name.name === 't' ||
|
|
86
|
+
node.key.name === 't') {
|
|
87
|
+
debug("call VAttribute[directive=true][key.name.name='t'] handling ...");
|
|
88
|
+
const key = getKeyFromVDirective(node);
|
|
89
|
+
if (key) {
|
|
90
|
+
results.add(String(key));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
if ((node.key.name === 'path' &&
|
|
96
|
+
(node.parent.parent.name === 'i18n' ||
|
|
97
|
+
node.parent.parent.name === 'i18n-t' ||
|
|
98
|
+
node.parent.parent.rawName === 'I18nT')) ||
|
|
99
|
+
(node.key.name === 'keypath' &&
|
|
100
|
+
(node.parent.parent.name === 'i18n-t' ||
|
|
101
|
+
node.parent.parent.rawName === 'I18nT'))) {
|
|
102
|
+
debug("call VElement:matches([name=i18n], [name=i18n-t], [name=I18nT]) > VStartTag > VAttribute[key.name='path'] handling ...");
|
|
103
|
+
const key = getKeyFromI18nComponent(node);
|
|
104
|
+
if (key) {
|
|
105
|
+
results.add(key);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (node.type === 'CallExpression') {
|
|
111
|
+
debug('CallExpression handling ...');
|
|
112
|
+
const key = getKeyFromCallExpression(node);
|
|
113
|
+
if (key) {
|
|
114
|
+
results.add(String(key));
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (node.templateBody) {
|
|
119
|
+
vue_eslint_parser_1.AST.traverseNodes(node.templateBody, {
|
|
120
|
+
enterNode,
|
|
121
|
+
leaveNode() {
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
vue_eslint_parser_1.AST.traverseNodes(node, {
|
|
126
|
+
visitorKeys,
|
|
127
|
+
enterNode,
|
|
128
|
+
leaveNode() {
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
return [...results];
|
|
132
|
+
}
|
|
133
|
+
exports.collectKeysFromAST = collectKeysFromAST;
|
|
134
|
+
class UsedKeysCache {
|
|
135
|
+
constructor() {
|
|
136
|
+
this._targetFilesLoader = new cache_loader_1.CacheLoader((cwd, files, extensions) => {
|
|
137
|
+
return (0, glob_utils_1.listFilesToProcess)(files, { cwd, extensions })
|
|
138
|
+
.filter(f => !f.ignored && extensions.includes((0, path_1.extname)(f.filename)))
|
|
139
|
+
.map(f => f.filename);
|
|
140
|
+
});
|
|
141
|
+
this._collectKeyResourcesFromFiles = (0, cache_function_1.defineCacheFunction)((fileNames, cwd) => {
|
|
142
|
+
return collectKeyResourcesFromFiles(fileNames, cwd);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
collectKeysFromFiles(files, extensions, context) {
|
|
146
|
+
const result = new Set();
|
|
147
|
+
for (const resource of this._getKeyResources(context, files, extensions)) {
|
|
148
|
+
for (const key of resource.getResource()) {
|
|
149
|
+
result.add(key);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return [...result];
|
|
153
|
+
}
|
|
154
|
+
_getKeyResources(context, files, extensions) {
|
|
155
|
+
const cwd = (0, get_cwd_1.getCwd)(context);
|
|
156
|
+
const fileNames = this._targetFilesLoader.get(cwd, files, extensions, cwd);
|
|
157
|
+
return this._collectKeyResourcesFromFiles(fileNames, cwd);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.usedKeysCache = new UsedKeysCache();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.collectLinkedKeys = void 0;
|
|
4
|
+
const traverser_1 = require("./message-compiler/traverser");
|
|
5
|
+
const parser_1 = require("./message-compiler/parser");
|
|
6
|
+
const parser_v9_1 = require("./message-compiler/parser-v9");
|
|
7
|
+
const utils_1 = require("./message-compiler/utils");
|
|
8
|
+
const utils_2 = require("./message-compiler/utils");
|
|
9
|
+
function* extractUsedKeysFromLinks(object, messageSyntaxVersions) {
|
|
10
|
+
for (const value of Object.values(object)) {
|
|
11
|
+
if (!value) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (typeof value === 'object') {
|
|
15
|
+
yield* extractUsedKeysFromLinks(value, messageSyntaxVersions);
|
|
16
|
+
}
|
|
17
|
+
else if (typeof value === 'string') {
|
|
18
|
+
if (messageSyntaxVersions.v10 || messageSyntaxVersions.v11) {
|
|
19
|
+
yield* extractUsedKeysFromAST((0, parser_1.parse)(value).ast);
|
|
20
|
+
}
|
|
21
|
+
if (messageSyntaxVersions.v9) {
|
|
22
|
+
yield* extractUsedKeysFromAST((0, parser_v9_1.parse)(value).ast);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function collectLinkedKeys(object, context) {
|
|
28
|
+
return [
|
|
29
|
+
...new Set(extractUsedKeysFromLinks(object, (0, utils_2.getMessageSyntaxVersions)(context)))
|
|
30
|
+
].filter(s => !!s);
|
|
31
|
+
}
|
|
32
|
+
exports.collectLinkedKeys = collectLinkedKeys;
|
|
33
|
+
function extractUsedKeysFromAST(ast) {
|
|
34
|
+
const keys = new Set();
|
|
35
|
+
(0, traverser_1.traverseNode)(ast, node => {
|
|
36
|
+
if (node.type === utils_1.NodeTypes.Linked) {
|
|
37
|
+
if (node.key.type === utils_1.NodeTypes.LinkedKey) {
|
|
38
|
+
keys.add(node.key.value);
|
|
39
|
+
}
|
|
40
|
+
else if (node.key.type === utils_1.NodeTypes.Literal && node.key.value) {
|
|
41
|
+
keys.add(node.key.value);
|
|
42
|
+
}
|
|
43
|
+
else if (node.key.type === utils_1.NodeTypes.List) {
|
|
44
|
+
keys.add(String(node.key.index));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return keys;
|
|
49
|
+
}
|
package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/compat.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getSourceCode = exports.getFilename = void 0;
|
|
27
|
+
const compat = __importStar(require("eslint-compat-utils"));
|
|
28
|
+
function getFilename(context) {
|
|
29
|
+
return compat.getFilename(context);
|
|
30
|
+
}
|
|
31
|
+
exports.getFilename = getFilename;
|
|
32
|
+
function getSourceCode(context) {
|
|
33
|
+
return compat.getSourceCode(context);
|
|
34
|
+
}
|
|
35
|
+
exports.getSourceCode = getSourceCode;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setTimeouts = exports.MTIME_MS_CHECK = exports.CACHE_LOADER = void 0;
|
|
4
|
+
exports.CACHE_LOADER = 1000;
|
|
5
|
+
exports.MTIME_MS_CHECK = 300;
|
|
6
|
+
function setTimeouts(times) {
|
|
7
|
+
exports.CACHE_LOADER = times.CACHE_LOADER;
|
|
8
|
+
exports.MTIME_MS_CHECK = times.MTIME_MS_CHECK;
|
|
9
|
+
}
|
|
10
|
+
exports.setTimeouts = setTimeouts;
|
package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/get-cwd.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCwd = void 0;
|
|
4
|
+
const eslint_compat_utils_1 = require("eslint-compat-utils");
|
|
5
|
+
function getCwd(context) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
return (_c = (_b = (_a = context.settings) === null || _a === void 0 ? void 0 : _a['vue-i18n']) === null || _b === void 0 ? void 0 : _b.cwd) !== null && _c !== void 0 ? _c : (0, eslint_compat_utils_1.getCwd)(context);
|
|
8
|
+
}
|
|
9
|
+
exports.getCwd = getCwd;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function resolveFileGlobPatterns(patterns: string[], options: {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
extensions?: string[];
|
|
4
|
+
globInputPaths?: boolean;
|
|
5
|
+
}): string[];
|
|
6
|
+
export declare function listFilesToProcess(globPatterns: string[], providedOptions: {
|
|
7
|
+
cwd?: string;
|
|
8
|
+
extensions?: string[];
|
|
9
|
+
globInputPaths?: boolean;
|
|
10
|
+
ignore?: boolean;
|
|
11
|
+
dotfiles?: boolean;
|
|
12
|
+
}): {
|
|
13
|
+
filename: string;
|
|
14
|
+
ignored: boolean;
|
|
15
|
+
}[];
|
package/packages/config-eslint/node_modules/@intlify/eslint-plugin-vue-i18n/dist/utils/glob-utils.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
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.listFilesToProcess = exports.resolveFileGlobPatterns = void 0;
|
|
7
|
+
const lodash_1 = require("lodash");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
const glob_1 = require("glob");
|
|
11
|
+
const path_utils_1 = require("./path-utils");
|
|
12
|
+
const ignored_paths_1 = require("./ignored-paths");
|
|
13
|
+
const debug_1 = __importDefault(require("debug"));
|
|
14
|
+
const debug = (0, debug_1.default)('eslint-plugin-vue-i18n:glob-utils');
|
|
15
|
+
function directoryExists(resolvedPath) {
|
|
16
|
+
return (0, fs_1.existsSync)(resolvedPath) && (0, fs_1.statSync)(resolvedPath).isDirectory();
|
|
17
|
+
}
|
|
18
|
+
function processPath(options) {
|
|
19
|
+
const cwd = (options && options.cwd) || process.cwd();
|
|
20
|
+
let extensions = (options && options.extensions) || ['.js'];
|
|
21
|
+
extensions = extensions.map(ext => ext.replace(/^\./, ''));
|
|
22
|
+
let suffix = '/**';
|
|
23
|
+
if (extensions.length === 1) {
|
|
24
|
+
suffix += `/*.${extensions[0]}`;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
suffix += `/*.{${extensions.join(',')}}`;
|
|
28
|
+
}
|
|
29
|
+
return function (pathname) {
|
|
30
|
+
let newPath = pathname;
|
|
31
|
+
const resolvedPath = (0, path_1.resolve)(cwd, pathname);
|
|
32
|
+
if (directoryExists(resolvedPath)) {
|
|
33
|
+
newPath = pathname.replace(/[/\\]$/, '') + suffix;
|
|
34
|
+
}
|
|
35
|
+
return (0, path_utils_1.convertPathToPosix)(newPath);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
class NoFilesFoundError extends Error {
|
|
39
|
+
constructor(pattern) {
|
|
40
|
+
super(`No files matching '${pattern}' were found.`);
|
|
41
|
+
this.messageTemplate = 'file-not-found';
|
|
42
|
+
this.messageData = { pattern };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
class AllFilesIgnoredError extends Error {
|
|
46
|
+
constructor(pattern) {
|
|
47
|
+
super(`All files matched by '${pattern}' are ignored.`);
|
|
48
|
+
this.messageTemplate = 'all-files-ignored';
|
|
49
|
+
this.messageData = { pattern };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const NORMAL_LINT = {};
|
|
53
|
+
const SILENTLY_IGNORE = {};
|
|
54
|
+
const IGNORE_AND_WARN = {};
|
|
55
|
+
function testFileAgainstIgnorePatterns(filename, options, isDirectPath, ignoredPaths) {
|
|
56
|
+
const shouldProcessCustomIgnores = options.ignore !== false;
|
|
57
|
+
const shouldLintIgnoredDirectPaths = options.ignore === false;
|
|
58
|
+
const fileMatchesIgnorePatterns = ignoredPaths.contains(filename, 'default') ||
|
|
59
|
+
(shouldProcessCustomIgnores && ignoredPaths.contains(filename, 'custom'));
|
|
60
|
+
if (fileMatchesIgnorePatterns &&
|
|
61
|
+
isDirectPath &&
|
|
62
|
+
!shouldLintIgnoredDirectPaths) {
|
|
63
|
+
return IGNORE_AND_WARN;
|
|
64
|
+
}
|
|
65
|
+
if (!fileMatchesIgnorePatterns ||
|
|
66
|
+
(isDirectPath && shouldLintIgnoredDirectPaths)) {
|
|
67
|
+
return NORMAL_LINT;
|
|
68
|
+
}
|
|
69
|
+
return SILENTLY_IGNORE;
|
|
70
|
+
}
|
|
71
|
+
function resolveFileGlobPatterns(patterns, options) {
|
|
72
|
+
if (options.globInputPaths === false) {
|
|
73
|
+
return patterns;
|
|
74
|
+
}
|
|
75
|
+
const processPathExtensions = processPath(options);
|
|
76
|
+
return patterns.map(processPathExtensions);
|
|
77
|
+
}
|
|
78
|
+
exports.resolveFileGlobPatterns = resolveFileGlobPatterns;
|
|
79
|
+
const dotfilesPattern = /(?:(?:^\.)|(?:[/\\]\.))[^/\\.].*/;
|
|
80
|
+
function listFilesToProcess(globPatterns, providedOptions) {
|
|
81
|
+
const options = providedOptions || { ignore: true };
|
|
82
|
+
const cwd = options.cwd || process.cwd();
|
|
83
|
+
const getIgnorePaths = (optionsObj) => new ignored_paths_1.IgnoredPaths(optionsObj);
|
|
84
|
+
const resolvedGlobPatterns = resolveFileGlobPatterns(globPatterns, options);
|
|
85
|
+
debug('Creating list of files to process.');
|
|
86
|
+
const resolvedPathsByGlobPattern = resolvedGlobPatterns.map(pattern => {
|
|
87
|
+
const file = (0, path_1.resolve)(cwd, pattern);
|
|
88
|
+
if (options.globInputPaths === false ||
|
|
89
|
+
((0, fs_1.existsSync)(file) && (0, fs_1.statSync)(file).isFile())) {
|
|
90
|
+
const ignoredPaths = getIgnorePaths(options);
|
|
91
|
+
const fullPath = options.globInputPaths === false ? file : (0, fs_1.realpathSync)(file);
|
|
92
|
+
return [
|
|
93
|
+
{
|
|
94
|
+
filename: fullPath,
|
|
95
|
+
behavior: testFileAgainstIgnorePatterns(fullPath, options, true, ignoredPaths)
|
|
96
|
+
}
|
|
97
|
+
];
|
|
98
|
+
}
|
|
99
|
+
const globIncludesDotfiles = dotfilesPattern.test(pattern);
|
|
100
|
+
let newOptions = options;
|
|
101
|
+
if (!options.dotfiles) {
|
|
102
|
+
newOptions = Object.assign({}, options, {
|
|
103
|
+
dotfiles: globIncludesDotfiles
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
const ignoredPaths = getIgnorePaths(newOptions);
|
|
107
|
+
const shouldIgnore = ignoredPaths.getIgnoredFoldersGlobChecker();
|
|
108
|
+
const globOptions = {
|
|
109
|
+
nodir: true,
|
|
110
|
+
dot: true,
|
|
111
|
+
cwd,
|
|
112
|
+
ignore: { ignored: shouldIgnore }
|
|
113
|
+
};
|
|
114
|
+
return (0, glob_1.globSync)(pattern, globOptions).map(globMatch => {
|
|
115
|
+
if (typeof globMatch !== 'string')
|
|
116
|
+
return;
|
|
117
|
+
const relativePath = (0, path_1.resolve)(cwd, globMatch);
|
|
118
|
+
return {
|
|
119
|
+
filename: relativePath,
|
|
120
|
+
behavior: testFileAgainstIgnorePatterns(relativePath, options, false, ignoredPaths)
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
const allPathDescriptors = resolvedPathsByGlobPattern.reduce((pathsForAllGlobs, pathsForCurrentGlob, index) => {
|
|
125
|
+
if (pathsForCurrentGlob.every(pathDescriptor => (pathDescriptor === null || pathDescriptor === void 0 ? void 0 : pathDescriptor.behavior) === SILENTLY_IGNORE)) {
|
|
126
|
+
throw new (pathsForCurrentGlob.length ? AllFilesIgnoredError : NoFilesFoundError)(globPatterns[index]);
|
|
127
|
+
}
|
|
128
|
+
pathsForCurrentGlob.forEach(pathDescriptor => {
|
|
129
|
+
switch (pathDescriptor === null || pathDescriptor === void 0 ? void 0 : pathDescriptor.behavior) {
|
|
130
|
+
case NORMAL_LINT:
|
|
131
|
+
pathsForAllGlobs.push({
|
|
132
|
+
filename: pathDescriptor.filename,
|
|
133
|
+
ignored: false
|
|
134
|
+
});
|
|
135
|
+
break;
|
|
136
|
+
case IGNORE_AND_WARN:
|
|
137
|
+
pathsForAllGlobs.push({
|
|
138
|
+
filename: pathDescriptor.filename,
|
|
139
|
+
ignored: true
|
|
140
|
+
});
|
|
141
|
+
break;
|
|
142
|
+
case SILENTLY_IGNORE:
|
|
143
|
+
break;
|
|
144
|
+
default:
|
|
145
|
+
throw new Error(`Unexpected file behavior for ${pathDescriptor === null || pathDescriptor === void 0 ? void 0 : pathDescriptor.filename}`);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return pathsForAllGlobs;
|
|
149
|
+
}, []);
|
|
150
|
+
const ret = (0, lodash_1.uniqBy)(allPathDescriptors, pathDescriptor => pathDescriptor.filename);
|
|
151
|
+
debug(ret);
|
|
152
|
+
return ret;
|
|
153
|
+
}
|
|
154
|
+
exports.listFilesToProcess = listFilesToProcess;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Ignore } from 'ignore';
|
|
2
|
+
import type { Path } from 'path-scurry';
|
|
3
|
+
export declare class IgnoredPaths {
|
|
4
|
+
cache: {
|
|
5
|
+
[key: string]: string[] | undefined;
|
|
6
|
+
};
|
|
7
|
+
defaultPatterns: string[];
|
|
8
|
+
ignoreFileDir: string;
|
|
9
|
+
options: {
|
|
10
|
+
dotfiles: boolean;
|
|
11
|
+
cwd: string;
|
|
12
|
+
patterns?: string[];
|
|
13
|
+
ignore?: boolean;
|
|
14
|
+
ignorePath?: string;
|
|
15
|
+
ignorePattern?: string;
|
|
16
|
+
};
|
|
17
|
+
private _baseDir;
|
|
18
|
+
ig: {
|
|
19
|
+
custom: Ignore & {
|
|
20
|
+
ignoreFiles: string[];
|
|
21
|
+
};
|
|
22
|
+
default: Ignore & {
|
|
23
|
+
ignoreFiles: string[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
constructor(providedOptions: {
|
|
27
|
+
dotfiles?: boolean | undefined;
|
|
28
|
+
cwd?: string | undefined;
|
|
29
|
+
patterns?: string[];
|
|
30
|
+
ignore?: boolean;
|
|
31
|
+
ignorePath?: string;
|
|
32
|
+
ignorePattern?: string;
|
|
33
|
+
});
|
|
34
|
+
addPatternRelativeToCwd(ig: Ignore, pattern: string): void;
|
|
35
|
+
addPatternRelativeToIgnoreFile(ig: Ignore, pattern: string): void;
|
|
36
|
+
getBaseDir(): string;
|
|
37
|
+
readIgnoreFile(filePath: string): string[];
|
|
38
|
+
addIgnoreFile(ig: Ignore & {
|
|
39
|
+
ignoreFiles: string[];
|
|
40
|
+
}, filePath: string): void;
|
|
41
|
+
contains(filepath: string, category?: 'custom' | 'default'): boolean;
|
|
42
|
+
getIgnoredFoldersGlobChecker(): (absolutePath: Path) => boolean;
|
|
43
|
+
}
|