eslint-plugin-mgw-eslint-rules 2.3.31 → 2.3.33
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.js +9 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3200,11 +3200,11 @@ var require_getParserServices = __commonJS({
|
|
|
3200
3200
|
"node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js"(exports2) {
|
|
3201
3201
|
"use strict";
|
|
3202
3202
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
3203
|
-
exports2.getParserServices =
|
|
3203
|
+
exports2.getParserServices = getParserServices2;
|
|
3204
3204
|
var parserSeemsToBeTSESLint_1 = require_parserSeemsToBeTSESLint();
|
|
3205
3205
|
var ERROR_MESSAGE_REQUIRES_PARSER_SERVICES = "You have used a rule which requires type information, but don't have parserOptions set to generate type information for this file. See https://tseslint.com/typed-linting for enabling linting with type information.";
|
|
3206
3206
|
var ERROR_MESSAGE_UNKNOWN_PARSER = 'Note: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward "parserOptions.project" to @typescript-eslint/parser.';
|
|
3207
|
-
function
|
|
3207
|
+
function getParserServices2(context, allowWithoutFullTypeInformation = false) {
|
|
3208
3208
|
const parser = context.parserPath || context.languageOptions.parser?.meta?.name;
|
|
3209
3209
|
if (context.sourceCode.parserServices?.esTreeNodeToTSNodeMap == null || context.sourceCode.parserServices.tsNodeToESTreeNodeMap == null) {
|
|
3210
3210
|
throwError(parser);
|
|
@@ -44248,6 +44248,7 @@ var rule6 = createRule6({
|
|
|
44248
44248
|
|
|
44249
44249
|
// src/rules/reactive-naming-convention.ts
|
|
44250
44250
|
var import_utils7 = __toESM(require_dist4());
|
|
44251
|
+
var import_eslint_utils = __toESM(require_eslint_utils3());
|
|
44251
44252
|
var RULE_NAME7 = "reactive-naming-convention";
|
|
44252
44253
|
var createRule7 = import_utils7.ESLintUtils.RuleCreator((name) => `https://github.com/developpement-megao/mgw-eslint-rules/docs/rules/${name}.md`);
|
|
44253
44254
|
var rule7 = createRule7({
|
|
@@ -44257,7 +44258,8 @@ var rule7 = createRule7({
|
|
|
44257
44258
|
fixable: "code",
|
|
44258
44259
|
docs: {
|
|
44259
44260
|
description: "Naming convention for reactive variables and properties (name must end with $ and $$ for WritableSignals and Subjects)",
|
|
44260
|
-
recommended: true
|
|
44261
|
+
recommended: true,
|
|
44262
|
+
requiresTypeChecking: true
|
|
44261
44263
|
},
|
|
44262
44264
|
messages: {
|
|
44263
44265
|
reactiveVariableNamingConvention: "Variable `{{ name }}` must end with `{{ suffix }}`.",
|
|
@@ -44268,19 +44270,16 @@ var rule7 = createRule7({
|
|
|
44268
44270
|
},
|
|
44269
44271
|
defaultOptions: [],
|
|
44270
44272
|
create(context) {
|
|
44271
|
-
const
|
|
44272
|
-
|
|
44273
|
-
return {};
|
|
44274
|
-
}
|
|
44273
|
+
const services = (0, import_eslint_utils.getParserServices)(context);
|
|
44274
|
+
const checker = services.program.getTypeChecker();
|
|
44275
44275
|
const listeReactiveWritableTypes = ["Subject", "WritableSignal", "InputSignal"];
|
|
44276
44276
|
const listeReactiveReadonlyTypes = ["Signal", "Observable", "Promise"];
|
|
44277
|
-
const checker = parserServices.program.getTypeChecker();
|
|
44278
44277
|
function checkNode(node, messageId) {
|
|
44279
44278
|
const name = node.name;
|
|
44280
|
-
if (!name || name === "_"
|
|
44279
|
+
if (!name || name === "_") {
|
|
44281
44280
|
return;
|
|
44282
44281
|
}
|
|
44283
|
-
const tsNode =
|
|
44282
|
+
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
|
|
44284
44283
|
const type = checker.getTypeAtLocation(tsNode);
|
|
44285
44284
|
const typeName = checker.typeToString(type);
|
|
44286
44285
|
const isReactiveWritableTypes = listeReactiveWritableTypes.some((t) => new RegExp(`${t}<.+>`).test(typeName));
|