@angular-eslint/eslint-plugin 18.2.1-alpha.4 → 18.2.1-alpha.6
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/README.md +1 -0
- package/dist/configs/all.json +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/rules/runtime-localize.d.ts +6 -0
- package/dist/rules/runtime-localize.d.ts.map +1 -0
- package/dist/rules/runtime-localize.js +42 -0
- package/dist/rules/use-injectable-provided-in.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -69,6 +69,7 @@ Please see https://github.com/angular-eslint/angular-eslint for full usage instr
|
|
|
69
69
|
| [`prefer-standalone`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-standalone.md) | Ensures component, directive and pipe `standalone` property is set to `true` in the component decorator | | :wrench: | |
|
|
70
70
|
| [`relative-url-prefix`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/relative-url-prefix.md) | The ./ and ../ prefix is standard syntax for relative URLs; don't depend on Angular's current ability to do without that prefix. See more at https://angular.dev/style-guide#style-05-04 | | | |
|
|
71
71
|
| [`require-localize-metadata`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/require-localize-metadata.md) | Ensures that $localize tagged messages contain helpful metadata to aid with translations. | | | |
|
|
72
|
+
| [`runtime-localize`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/runtime-localize.md) | Ensures that $localize tagged messages can use runtime-loaded translations. | | | |
|
|
72
73
|
| [`use-component-selector`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/use-component-selector.md) | Component selector must be declared | | | |
|
|
73
74
|
| [`use-component-view-encapsulation`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/use-component-view-encapsulation.md) | Disallows using `ViewEncapsulation.None` | | | :bulb: |
|
|
74
75
|
| [`use-injectable-provided-in`](https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin/docs/rules/use-injectable-provided-in.md) | Using the `providedIn` property makes `Injectables` tree-shakable | | | :bulb: |
|
package/dist/configs/all.json
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"@angular-eslint/prefer-standalone-component": "error",
|
|
35
35
|
"@angular-eslint/relative-url-prefix": "error",
|
|
36
36
|
"@angular-eslint/require-localize-metadata": "error",
|
|
37
|
+
"@angular-eslint/runtime-localize": "error",
|
|
37
38
|
"@angular-eslint/sort-lifecycle-methods": "error",
|
|
38
39
|
"@angular-eslint/sort-ngmodule-metadata-arrays": "error",
|
|
39
40
|
"@angular-eslint/use-component-selector": "error",
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ declare const _default: {
|
|
|
36
36
|
"@angular-eslint/prefer-standalone-component": string;
|
|
37
37
|
"@angular-eslint/relative-url-prefix": string;
|
|
38
38
|
"@angular-eslint/require-localize-metadata": string;
|
|
39
|
+
"@angular-eslint/runtime-localize": string;
|
|
39
40
|
"@angular-eslint/sort-lifecycle-methods": string;
|
|
40
41
|
"@angular-eslint/sort-ngmodule-metadata-arrays": string;
|
|
41
42
|
"@angular-eslint/use-component-selector": string;
|
|
@@ -97,6 +98,7 @@ declare const _default: {
|
|
|
97
98
|
"prefer-output-readonly": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/prefer-output-readonly").MessageIds, [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
98
99
|
"relative-url-prefix": import("@typescript-eslint/utils/ts-eslint").RuleModule<"relativeUrlPrefix", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
99
100
|
"require-localize-metadata": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./rules/require-localize-metadata").MessageIds, import("./rules/require-localize-metadata").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
101
|
+
"runtime-localize": import("@typescript-eslint/utils/ts-eslint").RuleModule<"runtimeLocalize", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
100
102
|
"sort-lifecycle-methods": import("@typescript-eslint/utils/ts-eslint").RuleModule<"lifecycleMethodsNotSorted", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
101
103
|
"sort-ngmodule-metadata-arrays": import("@typescript-eslint/utils/ts-eslint").RuleModule<"sortNgmoduleMetadataArrays", import("./rules/sort-ngmodule-metadata-arrays").Options, import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
102
104
|
"use-component-selector": import("@typescript-eslint/utils/ts-eslint").RuleModule<"useComponentSelector", [], import("./utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HA,kBAgDE"}
|
package/dist/index.js
CHANGED
|
@@ -58,6 +58,7 @@ const prefer_standalone_1 = __importStar(require("./rules/prefer-standalone"));
|
|
|
58
58
|
const prefer_standalone_component_1 = __importStar(require("./rules/prefer-standalone-component"));
|
|
59
59
|
const relative_url_prefix_1 = __importStar(require("./rules/relative-url-prefix"));
|
|
60
60
|
const require_localize_metadata_1 = __importStar(require("./rules/require-localize-metadata"));
|
|
61
|
+
const runtime_localize_1 = __importStar(require("./rules/runtime-localize"));
|
|
61
62
|
const sort_lifecycle_methods_1 = __importStar(require("./rules/sort-lifecycle-methods"));
|
|
62
63
|
const sort_ngmodule_metadata_arrays_1 = __importStar(require("./rules/sort-ngmodule-metadata-arrays"));
|
|
63
64
|
const use_component_selector_1 = __importStar(require("./rules/use-component-selector"));
|
|
@@ -104,6 +105,7 @@ module.exports = {
|
|
|
104
105
|
[prefer_output_readonly_1.RULE_NAME]: prefer_output_readonly_1.default,
|
|
105
106
|
[relative_url_prefix_1.RULE_NAME]: relative_url_prefix_1.default,
|
|
106
107
|
[require_localize_metadata_1.RULE_NAME]: require_localize_metadata_1.default,
|
|
108
|
+
[runtime_localize_1.RULE_NAME]: runtime_localize_1.default,
|
|
107
109
|
[sort_lifecycle_methods_1.RULE_NAME]: sort_lifecycle_methods_1.default,
|
|
108
110
|
[sort_ngmodule_metadata_arrays_1.RULE_NAME]: sort_ngmodule_metadata_arrays_1.default,
|
|
109
111
|
[use_component_selector_1.RULE_NAME]: use_component_selector_1.default,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type Options = [];
|
|
2
|
+
export type MessageIds = 'runtimeLocalize';
|
|
3
|
+
export declare const RULE_NAME = "runtime-localize";
|
|
4
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"runtimeLocalize", [], import("../utils/create-eslint-rule").RuleDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
5
|
+
export default _default;
|
|
6
|
+
//# sourceMappingURL=runtime-localize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-localize.d.ts","sourceRoot":"","sources":["../../src/rules/runtime-localize.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,OAAO,GAAG,EAAE,CAAC;AACzB,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAC3C,eAAO,MAAM,SAAS,qBAAqB,CAAC;;AAE5C,wBA6CG"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RULE_NAME = void 0;
|
|
4
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
+
const create_eslint_rule_1 = require("../utils/create-eslint-rule");
|
|
6
|
+
exports.RULE_NAME = 'runtime-localize';
|
|
7
|
+
exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
8
|
+
name: exports.RULE_NAME,
|
|
9
|
+
meta: {
|
|
10
|
+
type: 'suggestion',
|
|
11
|
+
docs: {
|
|
12
|
+
description: 'Ensures that $localize tagged messages can use runtime-loaded translations.',
|
|
13
|
+
},
|
|
14
|
+
schema: [],
|
|
15
|
+
messages: {
|
|
16
|
+
runtimeLocalize: `$localize could be called before translations are loaded`,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
defaultOptions: [],
|
|
20
|
+
create(context) {
|
|
21
|
+
return {
|
|
22
|
+
TaggedTemplateExpression(taggedTemplateExpression) {
|
|
23
|
+
if (utils_1.ASTUtils.isIdentifier(taggedTemplateExpression.tag) &&
|
|
24
|
+
taggedTemplateExpression.tag.name === '$localize') {
|
|
25
|
+
for (const ancestor of context.sourceCode.getAncestors(taggedTemplateExpression)) {
|
|
26
|
+
if (ancestor.type === utils_1.AST_NODE_TYPES.FunctionDeclaration ||
|
|
27
|
+
ancestor.type === utils_1.AST_NODE_TYPES.FunctionExpression ||
|
|
28
|
+
ancestor.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression ||
|
|
29
|
+
(ancestor.type === utils_1.AST_NODE_TYPES.PropertyDefinition &&
|
|
30
|
+
!ancestor.static)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
context.report({
|
|
35
|
+
loc: taggedTemplateExpression.tag.loc,
|
|
36
|
+
messageId: 'runtimeLocalize',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -49,7 +49,7 @@ exports.default = (0, create_eslint_rule_1.createESLintRule)({
|
|
|
49
49
|
fix: (fixer) => {
|
|
50
50
|
return utils_1.ASTUtils.isProperty(node)
|
|
51
51
|
? fixer.replaceText(node.value, `'${injector}'`)
|
|
52
|
-
: utils_1.RuleFixes.getDecoratorPropertyAddFix(node, fixer, `${METADATA_PROPERTY_NAME}: '${injector}'`) ?? [];
|
|
52
|
+
: (utils_1.RuleFixes.getDecoratorPropertyAddFix(node, fixer, `${METADATA_PROPERTY_NAME}: '${injector}'`) ?? []);
|
|
53
53
|
},
|
|
54
54
|
data: { injector },
|
|
55
55
|
})),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/eslint-plugin",
|
|
3
|
-
"version": "18.2.1-alpha.
|
|
3
|
+
"version": "18.2.1-alpha.6",
|
|
4
4
|
"description": "ESLint plugin for Angular applications, following https://angular.dev/style-guide",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"LICENSE"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@angular-eslint/bundled-angular-compiler": "18.2.1-alpha.
|
|
22
|
-
"@angular-eslint/utils": "18.2.1-alpha.
|
|
21
|
+
"@angular-eslint/bundled-angular-compiler": "18.2.1-alpha.6",
|
|
22
|
+
"@angular-eslint/utils": "18.2.1-alpha.6"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@angular-eslint/test-utils": "18.2.1-alpha.
|
|
25
|
+
"@angular-eslint/test-utils": "18.2.1-alpha.6",
|
|
26
26
|
"@angular-eslint/utils": "18.2.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|