@ms-cloudpack/eslint-plugin 0.8.1 → 0.9.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRule.d.ts","sourceRoot":"","sources":["../../src/utils/createRule.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEhF,KAAK,QAAQ,CAAC,CAAC,IAAI;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,WAAW,SAAS,MAAM,EAAE,UAAU,IAAI,IAAI,CAEzE,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,EAChD,MAAM,GAAG,MAAM,GAAG,SAAS,CAC5B,GAAG;IACF,IAAI,EAAE,UAAU,CAAC;IAEjB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,oBAAoB,CAAC,WAAW,EAAE,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC;CAClE,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,oBAAoB,CAAC,WAAW,SAAS,MAAM,EAAE,UAAU,IAAI,IAAI,CAC7E,gBAAgB,CAAC,WAAW,EAAE,UAAU,CAAC,EACzC,SAAS,GAAG,MAAM,CACnB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,QAAQ,EAAE,WAAW,SAAS,MAAM,EAAE,UAAU,IAAI,IAAI,CAC9E,QAAQ,CAAC,WAAW,CAAC,WAAW,EAAE,QAAQ,EAAE,CAAC,EAC7C,QAAQ,CACT,GAAG;IACF,MAAM,EAAE,CAAC,UAAU,EAAE,gBAAgB,CAAC,WAAW,EAAE,UAAU,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AU,EACzE,MAAM,EAAE,iBAAiB,CAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,CAAC,GAC3D,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAenC"}
|
package/lib/utils/createRule.js
CHANGED
|
@@ -14,15 +14,7 @@ export function createRule(params) {
|
|
|
14
14
|
},
|
|
15
15
|
defaultOptions: [],
|
|
16
16
|
create: (context) => {
|
|
17
|
-
|
|
18
|
-
// Fill in properties that were added in eslint 8.40.0
|
|
19
|
-
/* eslint-disable etc/no-deprecated */
|
|
20
|
-
contextCopy.cwd ??= context.getCwd?.();
|
|
21
|
-
contextCopy.filename ??= context.getFilename?.();
|
|
22
|
-
contextCopy.physicalFilename ??= context.getPhysicalFilename?.();
|
|
23
|
-
contextCopy.sourceCode ??= context.getSourceCode?.();
|
|
24
|
-
/* eslint-enable etc/no-deprecated */
|
|
25
|
-
return params.create(contextCopy);
|
|
17
|
+
return params.create(context);
|
|
26
18
|
},
|
|
27
19
|
};
|
|
28
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRule.js","sourceRoot":"","sources":["../../src/utils/createRule.ts"],"names":[],"mappings":"AA6DA;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,MAA4D;IAE5D,OAAO;QACL,GAAG,MAAM;QACT,IAAI,EAAE;YACJ,GAAG,MAAM,CAAC,IAAI;YACd,IAAI,EAAE;gBACJ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI;gBACnB,GAAG,EAAE,6DAA6D,MAAM,CAAC,IAAI,EAAE;aAChF;SACF;QACD,cAAc,EAAE,EAAE;QAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;YAClB,
|
|
1
|
+
{"version":3,"file":"createRule.js","sourceRoot":"","sources":["../../src/utils/createRule.ts"],"names":[],"mappings":"AA6DA;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,MAA4D;IAE5D,OAAO;QACL,GAAG,MAAM;QACT,IAAI,EAAE;YACJ,GAAG,MAAM,CAAC,IAAI;YACd,IAAI,EAAE;gBACJ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI;gBACnB,GAAG,EAAE,6DAA6D,MAAM,CAAC,IAAI,EAAE;aAChF;SACF;QACD,cAAc,EAAE,EAAE;QAClB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;YAClB,OAAO,MAAM,CAAC,MAAM,CAAC,OAAyD,CAAC,CAAC;QAClF,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["//\n// This file contains wrappers for rule creation and related types.\n//\nimport type { ESLintUtils, TSESLint, TSESTree } from '@typescript-eslint/utils';\n\ntype Writable<T> = { -readonly [K in keyof T]: T[K] };\n\n/**\n * Problem report descriptor with strongly typed error and suggestion data.\n * (This assumes all error/suggestion messages share a common data type.)\n */\nexport type ReportDescriptor<TMessageIds extends string, TErrorData> = Omit<\n // Make the descriptor writable for convenience (like conditionally adding a fix)\n Writable<TSESLint.ReportDescriptor<TMessageIds>>,\n 'data' | 'node' | 'suggest'\n> & {\n data: TErrorData;\n // have to re-declare `node` due to an oddity with union types (built-in ReportDescriptor is a union) and omit\n node: TSESTree.Node;\n suggest?: SuggestionDescriptor<TMessageIds, TErrorData>[] | null;\n};\n\n/** Fix suggestion with strongly typed data. */\nexport type SuggestionDescriptor<TMessageIds extends string, TErrorData> = Omit<\n ReportDescriptor<TMessageIds, TErrorData>,\n 'suggest' | 'node'\n>;\n\n/**\n * Rule context with strongly typed `report`.\n * (This assumes all error/suggestion messages share a common data type.)\n */\nexport type RuleContext<TOptions, TMessageIds extends string, TErrorData> = Omit<\n TSESLint.RuleContext<TMessageIds, TOptions[]>,\n 'report'\n> & {\n report: (descriptor: ReportDescriptor<TMessageIds, TErrorData>) => void;\n};\n\n/**\n * Rule info with better {@link RuleContext} type for the `create` function.\n * (This assumes all error/suggestion messages share a common data type.)\n */\ntype CreateRuleOptions<TOptions, TMessageIds extends string, TErrorData> = Omit<\n ESLintUtils.RuleWithMetaAndName<TOptions[], TMessageIds>,\n // Why remove defaultOptions (array): typescript-eslint merges this array with the original\n // options array and passes the merged array as the second argument to `create`. However,\n // this isn't reflected in the types, and its behavior is kind of weird (an empty `defaultOptions`\n // array will cause the provided options to be ignored). So remove it from the types\n // and fill in a default value in `createRule` instead.\n 'create' | 'defaultOptions'\n> & {\n create(this: void, context: Readonly<RuleContext<TOptions, TMessageIds, TErrorData>>): TSESLint.RuleListener;\n};\n\n/**\n * This exported alias is just to avoid an error when exporting the `rule` returned from `createRule`\n * (\"the inferred type of 'rule' cannot be named without a reference to ...\").\n */\nexport type RuleModule<TOptions, TMessageIds extends string> = ESLintUtils.RuleModule<TMessageIds, TOptions[]>;\n\n/**\n * Create a lint rule, with strongly typed data in `context.report`.\n * (This assumes all error/suggestion messages share a common data type.)\n */\nexport function createRule<TOptions, TMessageIds extends string, TErrorData>(\n params: CreateRuleOptions<TOptions, TMessageIds, TErrorData>,\n): RuleModule<TOptions, TMessageIds> {\n return {\n ...params,\n meta: {\n ...params.meta,\n docs: {\n ...params.meta.docs,\n url: `https://www.npmjs.com/package/@ms-cloudpack/eslint-plugin#${params.name}`,\n },\n },\n defaultOptions: [],\n create: (context) => {\n return params.create(context as RuleContext<TOptions, TMessageIds, TErrorData>);\n },\n };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/eslint-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "A set of ESLint rules for Cloudpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@rnx-kit/eslint-plugin": "^0.9.9",
|
|
31
|
-
"eslint": "^
|
|
31
|
+
"eslint": "^9.0.0 || ^10.0.0",
|
|
32
32
|
"typescript": ">=5.0.0",
|
|
33
33
|
"typescript-eslint": "^8.0.0"
|
|
34
34
|
},
|