@angular-eslint/utils 15.0.0-alpha.3 → 15.0.0-alpha.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.
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ParseSourceSpan, TmplAstElement } from '@angular-eslint/bundled-angular-compiler';
|
|
2
|
+
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
|
|
3
|
+
export interface TemplateParserServices {
|
|
4
|
+
convertNodeSourceSpanToLoc: (sourceSpan: ParseSourceSpan) => TSESTree.SourceLocation;
|
|
5
|
+
convertElementSourceSpanToLoc: (context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>, node: TmplAstElement) => TSESTree.SourceLocation;
|
|
6
|
+
}
|
|
7
|
+
export declare function getTemplateParserServices(context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>): TemplateParserServices;
|
|
8
|
+
/**
|
|
9
|
+
* Utility for rule authors to ensure that their rule is correctly being used with @angular-eslint/template-parser
|
|
10
|
+
* If @angular-eslint/template-parser is not the configured parser when the function is invoked it will throw
|
|
11
|
+
*/
|
|
12
|
+
export declare function ensureTemplateParser(context: Readonly<TSESLint.RuleContext<string, readonly unknown[]>>): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureTemplateParser = exports.getTemplateParserServices = void 0;
|
|
4
|
+
function getTemplateParserServices(context) {
|
|
5
|
+
ensureTemplateParser(context);
|
|
6
|
+
return context.parserServices;
|
|
7
|
+
}
|
|
8
|
+
exports.getTemplateParserServices = getTemplateParserServices;
|
|
9
|
+
/**
|
|
10
|
+
* Utility for rule authors to ensure that their rule is correctly being used with @angular-eslint/template-parser
|
|
11
|
+
* If @angular-eslint/template-parser is not the configured parser when the function is invoked it will throw
|
|
12
|
+
*/
|
|
13
|
+
function ensureTemplateParser(context) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
if (!((_a = context.parserServices) === null || _a === void 0 ? void 0 : _a.convertNodeSourceSpanToLoc) ||
|
|
16
|
+
!((_b = context.parserServices) === null || _b === void 0 ? void 0 : _b.convertElementSourceSpanToLoc)) {
|
|
17
|
+
/**
|
|
18
|
+
* The user needs to have configured "parser" in their eslint config and set it
|
|
19
|
+
* to @angular-eslint/template-parser
|
|
20
|
+
*/
|
|
21
|
+
throw new Error("You have used a rule which requires '@angular-eslint/template-parser' to be used as the 'parser' in your ESLint config.");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ensureTemplateParser = ensureTemplateParser;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,3 +7,5 @@ export * as ASTUtils from './eslint-plugin/ast-utils';
|
|
|
7
7
|
export * as RuleFixes from './eslint-plugin/rule-fixes';
|
|
8
8
|
export * as Selectors from './eslint-plugin/selectors';
|
|
9
9
|
export * as SelectorUtils from './eslint-plugin/selector-utils';
|
|
10
|
+
export type { TemplateParserServices } from './eslint-plugin-template/parser-services';
|
|
11
|
+
export { ensureTemplateParser, getTemplateParserServices, } from './eslint-plugin-template/parser-services';
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.SelectorUtils = exports.Selectors = exports.RuleFixes = exports.ASTUtils = exports.getNativeEventNames = exports.getAriaAttributeKeys = exports.capitalize = exports.withoutBracketsAndWhitespaces = exports.kebabToCamelCase = exports.toPattern = exports.isNotNullOrUndefined = exports.arrayify = exports.toHumanReadableText = void 0;
|
|
29
|
+
exports.getTemplateParserServices = exports.ensureTemplateParser = exports.SelectorUtils = exports.Selectors = exports.RuleFixes = exports.ASTUtils = exports.getNativeEventNames = exports.getAriaAttributeKeys = exports.capitalize = exports.withoutBracketsAndWhitespaces = exports.kebabToCamelCase = exports.toPattern = exports.isNotNullOrUndefined = exports.arrayify = exports.toHumanReadableText = void 0;
|
|
30
30
|
__exportStar(require("./convert-annotated-source-to-failure-case"), exports);
|
|
31
31
|
__exportStar(require("./rules-tester"), exports);
|
|
32
32
|
var utils_1 = require("./utils");
|
|
@@ -45,3 +45,6 @@ exports.ASTUtils = __importStar(require("./eslint-plugin/ast-utils"));
|
|
|
45
45
|
exports.RuleFixes = __importStar(require("./eslint-plugin/rule-fixes"));
|
|
46
46
|
exports.Selectors = __importStar(require("./eslint-plugin/selectors"));
|
|
47
47
|
exports.SelectorUtils = __importStar(require("./eslint-plugin/selector-utils"));
|
|
48
|
+
var parser_services_1 = require("./eslint-plugin-template/parser-services");
|
|
49
|
+
Object.defineProperty(exports, "ensureTemplateParser", { enumerable: true, get: function () { return parser_services_1.ensureTemplateParser; } });
|
|
50
|
+
Object.defineProperty(exports, "getTemplateParserServices", { enumerable: true, get: function () { return parser_services_1.getTemplateParserServices; } });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular-eslint/utils",
|
|
3
|
-
"version": "15.0.0-alpha.
|
|
3
|
+
"version": "15.0.0-alpha.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"typescript": "*"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@angular-eslint/bundled-angular-compiler": "15.0.0-alpha.
|
|
18
|
+
"@angular-eslint/bundled-angular-compiler": "15.0.0-alpha.5",
|
|
19
19
|
"@typescript-eslint/utils": "5.43.0"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "fed36400d7e0e754d241ded51ab54adacf226592"
|
|
22
22
|
}
|