Halfway done
This commit is contained in:
21
node_modules/@typescript-eslint/eslint-plugin/LICENSE
generated
vendored
Normal file
21
node_modules/@typescript-eslint/eslint-plugin/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 typescript-eslint and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
12
node_modules/@typescript-eslint/eslint-plugin/README.md
generated
vendored
Normal file
12
node_modules/@typescript-eslint/eslint-plugin/README.md
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# `@typescript-eslint/eslint-plugin`
|
||||
|
||||
An ESLint plugin which provides lint rules for TypeScript codebases.
|
||||
|
||||
[](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin)
|
||||
[](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin)
|
||||
|
||||
👉 See **https://typescript-eslint.io/getting-started** for our Getting Started docs.
|
||||
|
||||
> See https://typescript-eslint.io for general documentation on typescript-eslint, the tooling that allows you to run ESLint and Prettier on TypeScript code.
|
||||
|
||||
<!-- Local path for docs: docs/packages/ESLint_Plugin.mdx -->
|
||||
158
node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js
generated
vendored
Normal file
158
node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js
generated
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate:configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/base', './configs/eslint-recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
||||
'@typescript-eslint/array-type': 'error',
|
||||
'@typescript-eslint/await-thenable': 'error',
|
||||
'@typescript-eslint/ban-ts-comment': 'error',
|
||||
'@typescript-eslint/ban-tslint-comment': 'error',
|
||||
'@typescript-eslint/class-literal-property-style': 'error',
|
||||
'class-methods-use-this': 'off',
|
||||
'@typescript-eslint/class-methods-use-this': 'error',
|
||||
'@typescript-eslint/consistent-generic-constructors': 'error',
|
||||
'@typescript-eslint/consistent-indexed-object-style': 'error',
|
||||
'consistent-return': 'off',
|
||||
'@typescript-eslint/consistent-return': 'error',
|
||||
'@typescript-eslint/consistent-type-assertions': 'error',
|
||||
'@typescript-eslint/consistent-type-definitions': 'error',
|
||||
'@typescript-eslint/consistent-type-exports': 'error',
|
||||
'@typescript-eslint/consistent-type-imports': 'error',
|
||||
'default-param-last': 'off',
|
||||
'@typescript-eslint/default-param-last': 'error',
|
||||
'dot-notation': 'off',
|
||||
'@typescript-eslint/dot-notation': 'error',
|
||||
'@typescript-eslint/explicit-function-return-type': 'error',
|
||||
'@typescript-eslint/explicit-member-accessibility': 'error',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'error',
|
||||
'init-declarations': 'off',
|
||||
'@typescript-eslint/init-declarations': 'error',
|
||||
'max-params': 'off',
|
||||
'@typescript-eslint/max-params': 'error',
|
||||
'@typescript-eslint/member-ordering': 'error',
|
||||
'@typescript-eslint/method-signature-style': 'error',
|
||||
'@typescript-eslint/naming-convention': 'error',
|
||||
'no-array-constructor': 'off',
|
||||
'@typescript-eslint/no-array-constructor': 'error',
|
||||
'@typescript-eslint/no-array-delete': 'error',
|
||||
'@typescript-eslint/no-base-to-string': 'error',
|
||||
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-confusing-void-expression': 'error',
|
||||
'no-dupe-class-members': 'off',
|
||||
'@typescript-eslint/no-dupe-class-members': 'error',
|
||||
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
||||
'@typescript-eslint/no-duplicate-type-constituents': 'error',
|
||||
'@typescript-eslint/no-dynamic-delete': 'error',
|
||||
'no-empty-function': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'error',
|
||||
'@typescript-eslint/no-empty-object-type': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-extraneous-class': 'error',
|
||||
'@typescript-eslint/no-floating-promises': 'error',
|
||||
'@typescript-eslint/no-for-in-array': 'error',
|
||||
'no-implied-eval': 'off',
|
||||
'@typescript-eslint/no-implied-eval': 'error',
|
||||
'@typescript-eslint/no-import-type-side-effects': 'error',
|
||||
'@typescript-eslint/no-inferrable-types': 'error',
|
||||
'no-invalid-this': 'off',
|
||||
'@typescript-eslint/no-invalid-this': 'error',
|
||||
'@typescript-eslint/no-invalid-void-type': 'error',
|
||||
'no-loop-func': 'off',
|
||||
'@typescript-eslint/no-loop-func': 'error',
|
||||
'no-magic-numbers': 'off',
|
||||
'@typescript-eslint/no-magic-numbers': 'error',
|
||||
'@typescript-eslint/no-meaningless-void-operator': 'error',
|
||||
'@typescript-eslint/no-misused-new': 'error',
|
||||
'@typescript-eslint/no-misused-promises': 'error',
|
||||
'@typescript-eslint/no-mixed-enums': 'error',
|
||||
'@typescript-eslint/no-namespace': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'no-redeclare': 'off',
|
||||
'@typescript-eslint/no-redeclare': 'error',
|
||||
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
||||
'@typescript-eslint/no-require-imports': 'error',
|
||||
'no-restricted-imports': 'off',
|
||||
'@typescript-eslint/no-restricted-imports': 'error',
|
||||
'@typescript-eslint/no-restricted-types': 'error',
|
||||
'no-shadow': 'off',
|
||||
'@typescript-eslint/no-shadow': 'error',
|
||||
'@typescript-eslint/no-this-alias': 'error',
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'error',
|
||||
'@typescript-eslint/no-unnecessary-parameter-property-assignment': 'error',
|
||||
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
||||
'@typescript-eslint/no-unnecessary-template-expression': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-parameters': 'error',
|
||||
'@typescript-eslint/no-unsafe-argument': 'error',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'error',
|
||||
'@typescript-eslint/no-unsafe-call': 'error',
|
||||
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
||||
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
||||
'@typescript-eslint/no-unsafe-function-type': 'error',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'error',
|
||||
'@typescript-eslint/no-unsafe-return': 'error',
|
||||
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
||||
'no-unused-expressions': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'error',
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
'no-use-before-define': 'off',
|
||||
'@typescript-eslint/no-use-before-define': 'error',
|
||||
'no-useless-constructor': 'off',
|
||||
'@typescript-eslint/no-useless-constructor': 'error',
|
||||
'@typescript-eslint/no-useless-empty-export': 'error',
|
||||
'@typescript-eslint/no-wrapper-object-types': 'error',
|
||||
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
|
||||
'no-throw-literal': 'off',
|
||||
'@typescript-eslint/only-throw-error': 'error',
|
||||
'@typescript-eslint/parameter-properties': 'error',
|
||||
'@typescript-eslint/prefer-as-const': 'error',
|
||||
'prefer-destructuring': 'off',
|
||||
'@typescript-eslint/prefer-destructuring': 'error',
|
||||
'@typescript-eslint/prefer-enum-initializers': 'error',
|
||||
'@typescript-eslint/prefer-find': 'error',
|
||||
'@typescript-eslint/prefer-for-of': 'error',
|
||||
'@typescript-eslint/prefer-function-type': 'error',
|
||||
'@typescript-eslint/prefer-includes': 'error',
|
||||
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
||||
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
||||
'@typescript-eslint/prefer-optional-chain': 'error',
|
||||
'prefer-promise-reject-errors': 'off',
|
||||
'@typescript-eslint/prefer-promise-reject-errors': 'error',
|
||||
'@typescript-eslint/prefer-readonly': 'error',
|
||||
'@typescript-eslint/prefer-readonly-parameter-types': 'error',
|
||||
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
||||
'@typescript-eslint/prefer-regexp-exec': 'error',
|
||||
'@typescript-eslint/prefer-return-this-type': 'error',
|
||||
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
||||
'@typescript-eslint/promise-function-async': 'error',
|
||||
'@typescript-eslint/require-array-sort-compare': 'error',
|
||||
'require-await': 'off',
|
||||
'@typescript-eslint/require-await': 'error',
|
||||
'@typescript-eslint/restrict-plus-operands': 'error',
|
||||
'@typescript-eslint/restrict-template-expressions': 'error',
|
||||
'no-return-await': 'off',
|
||||
'@typescript-eslint/return-await': 'error',
|
||||
'@typescript-eslint/strict-boolean-expressions': 'error',
|
||||
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
||||
'@typescript-eslint/triple-slash-reference': 'error',
|
||||
'@typescript-eslint/typedef': 'error',
|
||||
'@typescript-eslint/unbound-method': 'error',
|
||||
'@typescript-eslint/unified-signatures': 'error',
|
||||
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=all.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"all.js","sourceRoot":"","sources":["../../src/configs/all.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,iDAAiD,EAAE,OAAO;QAC1D,+BAA+B,EAAE,OAAO;QACxC,mCAAmC,EAAE,OAAO;QAC5C,mCAAmC,EAAE,OAAO;QAC5C,uCAAuC,EAAE,OAAO;QAChD,iDAAiD,EAAE,OAAO;QAC1D,wBAAwB,EAAE,KAAK;QAC/B,2CAA2C,EAAE,OAAO;QACpD,oDAAoD,EAAE,OAAO;QAC7D,oDAAoD,EAAE,OAAO;QAC7D,mBAAmB,EAAE,KAAK;QAC1B,sCAAsC,EAAE,OAAO;QAC/C,+CAA+C,EAAE,OAAO;QACxD,gDAAgD,EAAE,OAA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4C,EAAE,OAAO;QACrD,sDAAsD,EAAE,OAAO;QAC/D,kBAAkB,EAAE,KAAK;QACzB,qCAAqC,EAAE,OAAO;QAC9C,yCAAyC,EAAE,OAAO;QAClD,oCAAoC,EAAE,OAAO;QAC7C,sBAAsB,EAAE,KAAK;QAC7B,yCAAyC,EAAE,OAAO;QAClD,6CAA6C,EAAE,OAAO;QACtD,gCAAgC,EAAE,OAAO;QACzC,kCAAkC,EAAE,OAAO;QAC3C,yCAAyC,EAAE,OAAO;QAClD,oCAAoC,EAAE,OAAO;QAC7C,+CAA+C,EAAE,OAAO;QACxD,6CAA6C,EAAE,OAAO;QACtD,8CAA8C,EAAE,OAAO;QACvD,0CAA0C,EAAE,OAAO;QACnD,8BAA8B,EAAE,KAAK;QACrC,iDAAiD,EAAE,OAAO;QAC1D,oCAAoC,EAAE,OAAO;QAC7C,oDAAoD,EAAE,OAAO;QAC7D,iDAAiD,EAAE,OAAO;QAC1D,uCAAuC,EAAE,OAAO;QAChD,4CAA4C,EAAE,OAAO;QACrD,mDAAmD,EAAE,OAAO;QAC5D,2CAA2C,EAAE,OAAO;QACpD,+CAA+C,EAAE,OAAO;QACxD,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,OAAO;QAC3C,2CAA2C,EAAE,OAAO;QACpD,kDAAkD,EAAE,OAAO;QAC3D,iBAAiB,EAAE,KAAK;QACxB,iCAAiC,EAAE,OAAO;QAC1C,+CAA+C,EAAE,OAAO;QACxD,gDAAgD,EAAE,OAAO;QACzD,2CAA2C,EAAE,OAAO;QACpD,4BAA4B,EAAE,OAAO;QACrC,mCAAmC,EAAE,OAAO;QAC5C,uCAAuC,EAAE,OAAO;QAChD,2DAA2D,EAAE,OAAO;KACrE;CAC6B,CAAC"}
|
||||
7
node_modules/@typescript-eslint/eslint-plugin/dist/configs/base.js
generated
vendored
Normal file
7
node_modules/@typescript-eslint/eslint-plugin/dist/configs/base.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: { sourceType: 'module' },
|
||||
plugins: ['@typescript-eslint'],
|
||||
};
|
||||
//# sourceMappingURL=base.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/base.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/base.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/configs/base.ts"],"names":[],"mappings":";AAEA,iBAAS;IACP,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;IACvC,OAAO,EAAE,CAAC,oBAAoB,CAAC;CACD,CAAC"}
|
||||
67
node_modules/@typescript-eslint/eslint-plugin/dist/configs/disable-type-checked.js
generated
vendored
Normal file
67
node_modules/@typescript-eslint/eslint-plugin/dist/configs/disable-type-checked.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate:configs`
|
||||
module.exports = {
|
||||
parserOptions: { project: false, program: null, projectService: false },
|
||||
rules: {
|
||||
'@typescript-eslint/await-thenable': 'off',
|
||||
'@typescript-eslint/consistent-return': 'off',
|
||||
'@typescript-eslint/consistent-type-exports': 'off',
|
||||
'@typescript-eslint/dot-notation': 'off',
|
||||
'@typescript-eslint/naming-convention': 'off',
|
||||
'@typescript-eslint/no-array-delete': 'off',
|
||||
'@typescript-eslint/no-base-to-string': 'off',
|
||||
'@typescript-eslint/no-confusing-void-expression': 'off',
|
||||
'@typescript-eslint/no-duplicate-type-constituents': 'off',
|
||||
'@typescript-eslint/no-floating-promises': 'off',
|
||||
'@typescript-eslint/no-for-in-array': 'off',
|
||||
'@typescript-eslint/no-implied-eval': 'off',
|
||||
'@typescript-eslint/no-meaningless-void-operator': 'off',
|
||||
'@typescript-eslint/no-misused-promises': 'off',
|
||||
'@typescript-eslint/no-mixed-enums': 'off',
|
||||
'@typescript-eslint/no-redundant-type-constituents': 'off',
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'off',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'off',
|
||||
'@typescript-eslint/no-unnecessary-qualifier': 'off',
|
||||
'@typescript-eslint/no-unnecessary-template-expression': 'off',
|
||||
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
|
||||
'@typescript-eslint/no-unnecessary-type-parameters': 'off',
|
||||
'@typescript-eslint/no-unsafe-argument': 'off',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'off',
|
||||
'@typescript-eslint/no-unsafe-call': 'off',
|
||||
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'off',
|
||||
'@typescript-eslint/no-unsafe-return': 'off',
|
||||
'@typescript-eslint/no-unsafe-unary-minus': 'off',
|
||||
'@typescript-eslint/non-nullable-type-assertion-style': 'off',
|
||||
'@typescript-eslint/only-throw-error': 'off',
|
||||
'@typescript-eslint/prefer-destructuring': 'off',
|
||||
'@typescript-eslint/prefer-find': 'off',
|
||||
'@typescript-eslint/prefer-includes': 'off',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'off',
|
||||
'@typescript-eslint/prefer-optional-chain': 'off',
|
||||
'@typescript-eslint/prefer-promise-reject-errors': 'off',
|
||||
'@typescript-eslint/prefer-readonly': 'off',
|
||||
'@typescript-eslint/prefer-readonly-parameter-types': 'off',
|
||||
'@typescript-eslint/prefer-reduce-type-parameter': 'off',
|
||||
'@typescript-eslint/prefer-regexp-exec': 'off',
|
||||
'@typescript-eslint/prefer-return-this-type': 'off',
|
||||
'@typescript-eslint/prefer-string-starts-ends-with': 'off',
|
||||
'@typescript-eslint/promise-function-async': 'off',
|
||||
'@typescript-eslint/require-array-sort-compare': 'off',
|
||||
'@typescript-eslint/require-await': 'off',
|
||||
'@typescript-eslint/restrict-plus-operands': 'off',
|
||||
'@typescript-eslint/restrict-template-expressions': 'off',
|
||||
'@typescript-eslint/return-await': 'off',
|
||||
'@typescript-eslint/strict-boolean-expressions': 'off',
|
||||
'@typescript-eslint/switch-exhaustiveness-check': 'off',
|
||||
'@typescript-eslint/unbound-method': 'off',
|
||||
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=disable-type-checked.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/disable-type-checked.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/disable-type-checked.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"disable-type-checked.js","sourceRoot":"","sources":["../../src/configs/disable-type-checked.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,aAAa,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE;IACvE,KAAK,EAAE;QACL,mCAAmC,EAAE,KAAK;QAC1C,sCAAsC,EAAE,KAAK;QAC7C,4CAA4C,EAAE,KAAK;QACnD,iCAAiC,EAAE,KAAK;QACxC,sCAAsC,EAAE,KAAK;QAC7C,oCAAoC,EAAE,KAAK;QAC3C,sCAAsC,EAAE,KAAK;QAC7C,iDAAiD,EAAE,KAAK;QACxD,mDAAmD,EAAE,KAAK;QAC1D,yCAAyC,EAAE,KAAK;QAChD,oCAAoC,EAAE,KAAK;QAC3C,oCAAoC,EAAE,KAAK;QAC3C,iDAAiD,EAAE,KAAK;QACxD,wCAAwC,EAAE,KAAK;QAC/C,mCAAmC,EAAE,KAAK;QAC1C,mDAAmD,EAAE,KAAK;QAC1D,2DAA2D,EAAE,KAAK;QAClE,6CAA6C,EAAE,KAAK;QACpD,6CAA6C,EAAE,KAAK;QACpD,uDAAuD,EAAE,KAAK;QAC9D,kDAAkD,EAAE,KAAK;QACzD,kDAAkD,EAAE,KAAK;QACzD,mDAAmD,EAAE,KAAK;QAC1D,uCAAuC,EAAE,KAAK;QAC9C,yCAAyC,EAAE,KAAK;QAChD,mCAAmC,EAAE,KAAK;QAC1C,8CAA8C,EAAE,KAAK;QACrD,4CAA4C,EAAE,KAAK;QACnD,qCAAqC,EAAE,KAAK;QAC5C,0CAA0C,EAAE,KAAK;QACjD,sDAAsD,EAAE,KAAK;QAC7D,qCAAqC,EAAE,KAAK;QAC5C,yCAAyC,EAAE,KAAK;QAChD,gCAAgC,EAAE,KAAK;QACvC,oCAAoC,EAAE,KAAK;QAC3C,8CAA8C,EAAE,KAAK;QACrD,0CAA0C,EAAE,KAAK;QACjD,iDAAiD,EAAE,KAAK;QACxD,oCAAoC,EAAE,KAAK;QAC3C,oDAAoD,EAAE,KAAK;QAC3D,iDAAiD,EAAE,KAAK;QACxD,uCAAuC,EAAE,KAAK;QAC9C,4CAA4C,EAAE,KAAK;QACnD,mDAAmD,EAAE,KAAK;QAC1D,2CAA2C,EAAE,KAAK;QAClD,+CAA+C,EAAE,KAAK;QACtD,kCAAkC,EAAE,KAAK;QACzC,2CAA2C,EAAE,KAAK;QAClD,kDAAkD,EAAE,KAAK;QACzD,iCAAiC,EAAE,KAAK;QACxC,+CAA+C,EAAE,KAAK;QACtD,gDAAgD,EAAE,KAAK;QACvD,mCAAmC,EAAE,KAAK;QAC1C,2DAA2D,EAAE,KAAK;KACnE;CAC6B,CAAC"}
|
||||
42
node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended-raw.js
generated
vendored
Normal file
42
node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended-raw.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
// NOTE: this file is isolated to be shared across legacy and flat configs
|
||||
// it is exported via `./use-at-your-own-risk/eslint-recommended-raw`
|
||||
// and it has types manually defined in `./eslint-recommended-raw.d.ts`
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* This is a compatibility ruleset that:
|
||||
* - disables rules from eslint:recommended which are already handled by TypeScript.
|
||||
* - enables rules that make sense due to TS's typechecking / transpilation.
|
||||
*/
|
||||
exports.default = (style) => ({
|
||||
files: style === 'glob'
|
||||
? // classic configs use glob syntax
|
||||
['*.ts', '*.tsx', '*.mts', '*.cts']
|
||||
: // flat configs use minimatch syntax
|
||||
['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
|
||||
rules: {
|
||||
'constructor-super': 'off', // ts(2335) & ts(2377)
|
||||
'getter-return': 'off', // ts(2378)
|
||||
'no-const-assign': 'off', // ts(2588)
|
||||
'no-dupe-args': 'off', // ts(2300)
|
||||
'no-dupe-class-members': 'off', // ts(2393) & ts(2300)
|
||||
'no-dupe-keys': 'off', // ts(1117)
|
||||
'no-func-assign': 'off', // ts(2630)
|
||||
'no-import-assign': 'off', // ts(2632) & ts(2540)
|
||||
// TODO - remove this once we no longer support ESLint v8
|
||||
'no-new-symbol': 'off', // ts(7009)
|
||||
'no-new-native-nonconstructor': 'off', // ts(7009)
|
||||
'no-obj-calls': 'off', // ts(2349)
|
||||
'no-redeclare': 'off', // ts(2451)
|
||||
'no-setter-return': 'off', // ts(2408)
|
||||
'no-this-before-super': 'off', // ts(2376) & ts(17009)
|
||||
'no-undef': 'off', // ts(2304) & ts(2552)
|
||||
'no-unreachable': 'off', // ts(7027)
|
||||
'no-unsafe-negation': 'off', // ts(2365) & ts(2322) & ts(2358)
|
||||
'no-var': 'error', // ts transpiles let/const to var, so no need for vars any more
|
||||
'prefer-const': 'error', // ts provides better types with const
|
||||
'prefer-rest-params': 'error', // ts provides better types with rest args over arguments
|
||||
'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=eslint-recommended-raw.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended-raw.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended-raw.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"eslint-recommended-raw.js","sourceRoot":"","sources":["../../src/configs/eslint-recommended-raw.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,uEAAuE;;AAEvE;;;;GAIG;AACH,kBAAe,CACb,KAA2B,EAI3B,EAAE,CAAC,CAAC;IACJ,KAAK,EACH,KAAK,KAAK,MAAM;QACd,CAAC,CAAC,kCAAkC;YAClC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;QACrC,CAAC,CAAC,oCAAoC;YACpC,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC;IACrD,KAAK,EAAE;QACL,mBAAmB,EAAE,KAAK,EAAE,sBAAsB;QAClD,eAAe,EAAE,KAAK,EAAE,WAAW;QACnC,iBAAiB,EAAE,KAAK,EAAE,WAAW;QACrC,cAAc,EAAE,KAAK,EAAE,WAAW;QAClC,uBAAuB,EAAE,KAAK,EAAE,sBAAsB;QACtD,cAAc,EAAE,KAAK,EAAE,WAAW;QAClC,gBAAgB,EAAE,KAAK,EAAE,WAAW;QACpC,kBAAkB,EAAE,KAAK,EAAE,sBAAsB;QACjD,yDAAyD;QACzD,eAAe,EAAE,KAAK,EAAE,WAAW;QACnC,8BAA8B,EAAE,KAAK,EAAE,WAAW;QAClD,cAAc,EAAE,KAAK,EAAE,WAAW;QAClC,cAAc,EAAE,KAAK,EAAE,WAAW;QAClC,kBAAkB,EAAE,KAAK,EAAE,WAAW;QACtC,sBAAsB,EAAE,KAAK,EAAE,uBAAuB;QACtD,UAAU,EAAE,KAAK,EAAE,sBAAsB;QACzC,gBAAgB,EAAE,KAAK,EAAE,WAAW;QACpC,oBAAoB,EAAE,KAAK,EAAE,iCAAiC;QAC9D,QAAQ,EAAE,OAAO,EAAE,+DAA+D;QAClF,cAAc,EAAE,OAAO,EAAE,sCAAsC;QAC/D,oBAAoB,EAAE,OAAO,EAAE,yDAAyD;QACxF,eAAe,EAAE,OAAO,EAAE,6DAA6D;KACxF;CACF,CAAC,CAAC"}
|
||||
14
node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended.js
generated
vendored
Normal file
14
node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
/**
|
||||
* This is a compatibility ruleset that:
|
||||
* - disables rules from eslint:recommended which are already handled by TypeScript.
|
||||
* - enables rules that make sense due to TS's typechecking / transpilation.
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const eslint_recommended_raw_1 = __importDefault(require("./eslint-recommended-raw"));
|
||||
module.exports = {
|
||||
overrides: [(0, eslint_recommended_raw_1.default)('glob')],
|
||||
};
|
||||
//# sourceMappingURL=eslint-recommended.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"eslint-recommended.js","sourceRoot":"","sources":["../../src/configs/eslint-recommended.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;AAIH,sFAA6D;AAE7D,iBAAS;IACP,SAAS,EAAE,CAAC,IAAA,gCAAqB,EAAC,MAAM,CAAC,CAAC;CACZ,CAAC"}
|
||||
40
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended-type-checked-only.js
generated
vendored
Normal file
40
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended-type-checked-only.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate:configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/base', './configs/eslint-recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/await-thenable': 'error',
|
||||
'@typescript-eslint/no-array-delete': 'error',
|
||||
'@typescript-eslint/no-base-to-string': 'error',
|
||||
'@typescript-eslint/no-duplicate-type-constituents': 'error',
|
||||
'@typescript-eslint/no-floating-promises': 'error',
|
||||
'@typescript-eslint/no-for-in-array': 'error',
|
||||
'no-implied-eval': 'off',
|
||||
'@typescript-eslint/no-implied-eval': 'error',
|
||||
'@typescript-eslint/no-misused-promises': 'error',
|
||||
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
||||
'@typescript-eslint/no-unsafe-argument': 'error',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'error',
|
||||
'@typescript-eslint/no-unsafe-call': 'error',
|
||||
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'error',
|
||||
'@typescript-eslint/no-unsafe-return': 'error',
|
||||
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
||||
'no-throw-literal': 'off',
|
||||
'@typescript-eslint/only-throw-error': 'error',
|
||||
'prefer-promise-reject-errors': 'off',
|
||||
'@typescript-eslint/prefer-promise-reject-errors': 'error',
|
||||
'require-await': 'off',
|
||||
'@typescript-eslint/require-await': 'error',
|
||||
'@typescript-eslint/restrict-plus-operands': 'error',
|
||||
'@typescript-eslint/restrict-template-expressions': 'error',
|
||||
'@typescript-eslint/unbound-method': 'error',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=recommended-type-checked-only.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended-type-checked-only.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended-type-checked-only.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"recommended-type-checked-only.js","sourceRoot":"","sources":["../../src/configs/recommended-type-checked-only.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,mCAAmC,EAAE,OAAO;QAC5C,oCAAoC,EAAE,OAAO;QAC7C,sCAAsC,EAAE,OAAO;QAC/C,mDAAmD,EAAE,OAAO;QAC5D,yCAAyC,EAAE,OAAO;QAClD,oCAAoC,EAAE,OAAO;QAC7C,iBAAiB,EAAE,KAAK;QACxB,oCAAoC,EAAE,OAAO;QAC7C,wCAAwC,EAAE,OAAO;QACjD,mDAAmD,EAAE,OAAO;QAC5D,kDAAkD,EAAE,OAAO;QAC3D,uCAAuC,EAAE,OAAO;QAChD,yCAAyC,EAAE,OAAO;QAClD,mCAAmC,EAAE,OAAO;QAC5C,8CAA8C,EAAE,OAAO;QACvD,4CAA4C,EAAE,OAAO;QACrD,qCAAqC,EAAE,OAAO;QAC9C,0CAA0C,EAAE,OAAO;QACnD,kBAAkB,EAAE,KAAK;QACzB,qCAAqC,EAAE,OAAO;QAC9C,8BAA8B,EAAE,KAAK;QACrC,iDAAiD,EAAE,OAAO;QAC1D,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,OAAO;QAC3C,2CAA2C,EAAE,OAAO;QACpD,kDAAkD,EAAE,OAAO;QAC3D,mCAAmC,EAAE,OAAO;KAC7C;CAC6B,CAAC"}
|
||||
63
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended-type-checked.js
generated
vendored
Normal file
63
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended-type-checked.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate:configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/base', './configs/eslint-recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/await-thenable': 'error',
|
||||
'@typescript-eslint/ban-ts-comment': 'error',
|
||||
'no-array-constructor': 'off',
|
||||
'@typescript-eslint/no-array-constructor': 'error',
|
||||
'@typescript-eslint/no-array-delete': 'error',
|
||||
'@typescript-eslint/no-base-to-string': 'error',
|
||||
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
||||
'@typescript-eslint/no-duplicate-type-constituents': 'error',
|
||||
'@typescript-eslint/no-empty-object-type': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-floating-promises': 'error',
|
||||
'@typescript-eslint/no-for-in-array': 'error',
|
||||
'no-implied-eval': 'off',
|
||||
'@typescript-eslint/no-implied-eval': 'error',
|
||||
'@typescript-eslint/no-misused-new': 'error',
|
||||
'@typescript-eslint/no-misused-promises': 'error',
|
||||
'@typescript-eslint/no-namespace': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
||||
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
||||
'@typescript-eslint/no-require-imports': 'error',
|
||||
'@typescript-eslint/no-this-alias': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
||||
'@typescript-eslint/no-unsafe-argument': 'error',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'error',
|
||||
'@typescript-eslint/no-unsafe-call': 'error',
|
||||
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
||||
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
||||
'@typescript-eslint/no-unsafe-function-type': 'error',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'error',
|
||||
'@typescript-eslint/no-unsafe-return': 'error',
|
||||
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
||||
'no-unused-expressions': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'error',
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
'@typescript-eslint/no-wrapper-object-types': 'error',
|
||||
'no-throw-literal': 'off',
|
||||
'@typescript-eslint/only-throw-error': 'error',
|
||||
'@typescript-eslint/prefer-as-const': 'error',
|
||||
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
||||
'prefer-promise-reject-errors': 'off',
|
||||
'@typescript-eslint/prefer-promise-reject-errors': 'error',
|
||||
'require-await': 'off',
|
||||
'@typescript-eslint/require-await': 'error',
|
||||
'@typescript-eslint/restrict-plus-operands': 'error',
|
||||
'@typescript-eslint/restrict-template-expressions': 'error',
|
||||
'@typescript-eslint/triple-slash-reference': 'error',
|
||||
'@typescript-eslint/unbound-method': 'error',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=recommended-type-checked.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended-type-checked.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended-type-checked.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"recommended-type-checked.js","sourceRoot":"","sources":["../../src/configs/recommended-type-checked.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD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C7C,6CAA6C,EAAE,OAAO;QACtD,8BAA8B,EAAE,KAAK;QACrC,iDAAiD,EAAE,OAAO;QAC1D,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,OAAO;QAC3C,2CAA2C,EAAE,OAAO;QACpD,kDAAkD,EAAE,OAAO;QAC3D,2CAA2C,EAAE,OAAO;QACpD,mCAAmC,EAAE,OAAO;KAC7C;CAC6B,CAAC"}
|
||||
36
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended.js
generated
vendored
Normal file
36
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate:configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/base', './configs/eslint-recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/ban-ts-comment': 'error',
|
||||
'no-array-constructor': 'off',
|
||||
'@typescript-eslint/no-array-constructor': 'error',
|
||||
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
||||
'@typescript-eslint/no-empty-object-type': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-misused-new': 'error',
|
||||
'@typescript-eslint/no-namespace': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
||||
'@typescript-eslint/no-require-imports': 'error',
|
||||
'@typescript-eslint/no-this-alias': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
||||
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
||||
'@typescript-eslint/no-unsafe-function-type': 'error',
|
||||
'no-unused-expressions': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'error',
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
'@typescript-eslint/no-wrapper-object-types': 'error',
|
||||
'@typescript-eslint/prefer-as-const': 'error',
|
||||
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
||||
'@typescript-eslint/triple-slash-reference': 'error',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=recommended.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"recommended.js","sourceRoot":"","sources":["../../src/configs/recommended.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,mCAAmC,EAAE,OAAO;QAC5C,sBAAsB,EAAE,KAAK;QAC7B,yCAAyC,EAAE,OAAO;QAClD,6CAA6C,EAAE,OAAO;QACtD,yCAAyC,EAAE,OAAO;QAClD,oCAAoC,EAAE,OAAO;QAC7C,gDAAgD,EAAE,OAAO;QACzD,mCAAmC,EAAE,OAAO;QAC5C,iCAAiC,EAAE,OAAO;QAC1C,wDAAwD,EAAE,OAAO;QACjE,uCAAuC,EAAE,OAAO;QAChD,kCAAkC,EAAE,OAAO;QAC3C,mDAAmD,EAAE,OAAO;QAC5D,kDAAkD,EAAE,OAAO;QAC3D,4CAA4C,EAAE,OAAO;QACrD,uBAAuB,EAAE,KAAK;QAC9B,0CAA0C,EAAE,OAAO;QACnD,gBAAgB,EAAE,KAAK;QACvB,mCAAmC,EAAE,OAAO;QAC5C,4CAA4C,EAAE,OAAO;QACrD,oCAAoC,EAAE,OAAO;QAC7C,6CAA6C,EAAE,OAAO;QACtD,2CAA2C,EAAE,OAAO;KACrD;CAC6B,CAAC"}
|
||||
75
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict-type-checked-only.js
generated
vendored
Normal file
75
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict-type-checked-only.js
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate:configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/base', './configs/eslint-recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/await-thenable': 'error',
|
||||
'@typescript-eslint/no-array-delete': 'error',
|
||||
'@typescript-eslint/no-base-to-string': 'error',
|
||||
'@typescript-eslint/no-confusing-void-expression': 'error',
|
||||
'@typescript-eslint/no-duplicate-type-constituents': 'error',
|
||||
'@typescript-eslint/no-floating-promises': 'error',
|
||||
'@typescript-eslint/no-for-in-array': 'error',
|
||||
'no-implied-eval': 'off',
|
||||
'@typescript-eslint/no-implied-eval': 'error',
|
||||
'@typescript-eslint/no-meaningless-void-operator': 'error',
|
||||
'@typescript-eslint/no-misused-promises': 'error',
|
||||
'@typescript-eslint/no-mixed-enums': 'error',
|
||||
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'error',
|
||||
'@typescript-eslint/no-unnecessary-template-expression': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-parameters': 'error',
|
||||
'@typescript-eslint/no-unsafe-argument': 'error',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'error',
|
||||
'@typescript-eslint/no-unsafe-call': 'error',
|
||||
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'error',
|
||||
'@typescript-eslint/no-unsafe-return': 'error',
|
||||
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
||||
'no-throw-literal': 'off',
|
||||
'@typescript-eslint/only-throw-error': 'error',
|
||||
'prefer-promise-reject-errors': 'off',
|
||||
'@typescript-eslint/prefer-promise-reject-errors': 'error',
|
||||
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
||||
'@typescript-eslint/prefer-return-this-type': 'error',
|
||||
'require-await': 'off',
|
||||
'@typescript-eslint/require-await': 'error',
|
||||
'@typescript-eslint/restrict-plus-operands': [
|
||||
'error',
|
||||
{
|
||||
allowAny: false,
|
||||
allowBoolean: false,
|
||||
allowNullish: false,
|
||||
allowNumberAndString: false,
|
||||
allowRegExp: false,
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/restrict-template-expressions': [
|
||||
'error',
|
||||
{
|
||||
allowAny: false,
|
||||
allowBoolean: false,
|
||||
allowNullish: false,
|
||||
allowNumber: false,
|
||||
allowRegExp: false,
|
||||
allowNever: false,
|
||||
},
|
||||
],
|
||||
'no-return-await': 'off',
|
||||
'@typescript-eslint/return-await': [
|
||||
'error',
|
||||
'error-handling-correctness-only',
|
||||
],
|
||||
'@typescript-eslint/unbound-method': 'error',
|
||||
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=strict-type-checked-only.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict-type-checked-only.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict-type-checked-only.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"strict-type-checked-only.js","sourceRoot":"","sources":["../../src/configs/strict-type-checked-only.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC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QACD,kDAAkD,EAAE;YAClD,OAAO;YACP;gBACE,QAAQ,EAAE,KAAK;gBACf,YAAY,EAAE,KAAK;gBACnB,YAAY,EAAE,KAAK;gBACnB,WAAW,EAAE,KAAK;gBAClB,WAAW,EAAE,KAAK;gBAClB,UAAU,EAAE,KAAK;aAClB;SACF;QACD,iBAAiB,EAAE,KAAK;QACxB,iCAAiC,EAAE;YACjC,OAAO;YACP,iCAAiC;SAClC;QACD,mCAAmC,EAAE,OAAO;QAC5C,2DAA2D,EAAE,OAAO;KACrE;CAC6B,CAAC"}
|
||||
110
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict-type-checked.js
generated
vendored
Normal file
110
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict-type-checked.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate:configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/base', './configs/eslint-recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/await-thenable': 'error',
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
'error',
|
||||
{ minimumDescriptionLength: 10 },
|
||||
],
|
||||
'no-array-constructor': 'off',
|
||||
'@typescript-eslint/no-array-constructor': 'error',
|
||||
'@typescript-eslint/no-array-delete': 'error',
|
||||
'@typescript-eslint/no-base-to-string': 'error',
|
||||
'@typescript-eslint/no-confusing-void-expression': 'error',
|
||||
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
||||
'@typescript-eslint/no-duplicate-type-constituents': 'error',
|
||||
'@typescript-eslint/no-dynamic-delete': 'error',
|
||||
'@typescript-eslint/no-empty-object-type': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-extraneous-class': 'error',
|
||||
'@typescript-eslint/no-floating-promises': 'error',
|
||||
'@typescript-eslint/no-for-in-array': 'error',
|
||||
'no-implied-eval': 'off',
|
||||
'@typescript-eslint/no-implied-eval': 'error',
|
||||
'@typescript-eslint/no-invalid-void-type': 'error',
|
||||
'@typescript-eslint/no-meaningless-void-operator': 'error',
|
||||
'@typescript-eslint/no-misused-new': 'error',
|
||||
'@typescript-eslint/no-misused-promises': 'error',
|
||||
'@typescript-eslint/no-mixed-enums': 'error',
|
||||
'@typescript-eslint/no-namespace': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-redundant-type-constituents': 'error',
|
||||
'@typescript-eslint/no-require-imports': 'error',
|
||||
'@typescript-eslint/no-this-alias': 'error',
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'error',
|
||||
'@typescript-eslint/no-unnecessary-template-expression': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-arguments': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-parameters': 'error',
|
||||
'@typescript-eslint/no-unsafe-argument': 'error',
|
||||
'@typescript-eslint/no-unsafe-assignment': 'error',
|
||||
'@typescript-eslint/no-unsafe-call': 'error',
|
||||
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
||||
'@typescript-eslint/no-unsafe-enum-comparison': 'error',
|
||||
'@typescript-eslint/no-unsafe-function-type': 'error',
|
||||
'@typescript-eslint/no-unsafe-member-access': 'error',
|
||||
'@typescript-eslint/no-unsafe-return': 'error',
|
||||
'@typescript-eslint/no-unsafe-unary-minus': 'error',
|
||||
'no-unused-expressions': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'error',
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
'no-useless-constructor': 'off',
|
||||
'@typescript-eslint/no-useless-constructor': 'error',
|
||||
'@typescript-eslint/no-wrapper-object-types': 'error',
|
||||
'no-throw-literal': 'off',
|
||||
'@typescript-eslint/only-throw-error': 'error',
|
||||
'@typescript-eslint/prefer-as-const': 'error',
|
||||
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
||||
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
||||
'prefer-promise-reject-errors': 'off',
|
||||
'@typescript-eslint/prefer-promise-reject-errors': 'error',
|
||||
'@typescript-eslint/prefer-reduce-type-parameter': 'error',
|
||||
'@typescript-eslint/prefer-return-this-type': 'error',
|
||||
'require-await': 'off',
|
||||
'@typescript-eslint/require-await': 'error',
|
||||
'@typescript-eslint/restrict-plus-operands': [
|
||||
'error',
|
||||
{
|
||||
allowAny: false,
|
||||
allowBoolean: false,
|
||||
allowNullish: false,
|
||||
allowNumberAndString: false,
|
||||
allowRegExp: false,
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/restrict-template-expressions': [
|
||||
'error',
|
||||
{
|
||||
allowAny: false,
|
||||
allowBoolean: false,
|
||||
allowNullish: false,
|
||||
allowNumber: false,
|
||||
allowRegExp: false,
|
||||
allowNever: false,
|
||||
},
|
||||
],
|
||||
'no-return-await': 'off',
|
||||
'@typescript-eslint/return-await': [
|
||||
'error',
|
||||
'error-handling-correctness-only',
|
||||
],
|
||||
'@typescript-eslint/triple-slash-reference': 'error',
|
||||
'@typescript-eslint/unbound-method': 'error',
|
||||
'@typescript-eslint/unified-signatures': 'error',
|
||||
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'error',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=strict-type-checked.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict-type-checked.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict-type-checked.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"strict-type-checked.js","sourceRoot":"","sources":["../../src/configs/strict-type-checked.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,mCAAmC,EAAE,OAAO;QAC5C,mCAAmC,EAAE;YACnC,OAAO;YACP,EAAE,wBAAwB,EAAE,EAAE,EAAE;SACjC;QACD,sBAAsB,EAAE,KAAK;QAC7B,yCAAyC,EAAE,OAAO;QAClD,oCAAoC,EAAE,OAAO;QAC7C,sCAAsC,EAAE,OAAO;QAC/C,iDAAiD,EAAE,OAAO;QAC1D,6CAA6C,EAAE,OAAO;QACtD,mDAAmD,EAAE,OAAO;QAC5D,sCAAsC,EAAE,OAAO;QAC/C,yCAAyC,EAAE,OAAO;QAClD,oCAAoC,EAAE,OAAO;QAC7C,gDAAgD,EAAE,OAAO;QACzD,wCAAwC,EAAE,OAAO;QACjD,yCAAyC,EAAE,OAAO;QAClD,oCAAoC,EAAE,OAAO;QAC7C,iBAAiB,EAAE,KAAK;QACxB,oCAAoC,EAAE,OAAO;QAC7C,yCAAyC,EAAE,OAAO;QAClD,iDAAiD,EAAE,OAAO;QAC1D,mCAAmC,EAAE,OAAO;QAC5C,wCAAwC,EAAE,OAAO;QACjD,mCAAmC,EAAE,OAAO;QAC5C,iCAAiC,EAAE,OAAO;QAC1C,4DAA4D,EAAE,OAAO;QACrE,wDAAwD,EAAE,OAAO;QACjE,0CAA0C,EAAE,OAAO;QACnD,mDAAmD,EAAE,OAAO;QAC5D,uCAAuC,EAAE,OAAO;QAChD,kCAAkC,EAAE,OAAO;QAC3C,2DAA2D,EAAE,OAAO;QAC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,UAAU,EAAE,KAAK;aAClB;SACF;QACD,iBAAiB,EAAE,KAAK;QACxB,iCAAiC,EAAE;YACjC,OAAO;YACP,iCAAiC;SAClC;QACD,2CAA2C,EAAE,OAAO;QACpD,mCAAmC,EAAE,OAAO;QAC5C,uCAAuC,EAAE,OAAO;QAChD,2DAA2D,EAAE,OAAO;KACrE;CAC6B,CAAC"}
|
||||
48
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js
generated
vendored
Normal file
48
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate:configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/base', './configs/eslint-recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
'error',
|
||||
{ minimumDescriptionLength: 10 },
|
||||
],
|
||||
'no-array-constructor': 'off',
|
||||
'@typescript-eslint/no-array-constructor': 'error',
|
||||
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
||||
'@typescript-eslint/no-dynamic-delete': 'error',
|
||||
'@typescript-eslint/no-empty-object-type': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-extraneous-class': 'error',
|
||||
'@typescript-eslint/no-invalid-void-type': 'error',
|
||||
'@typescript-eslint/no-misused-new': 'error',
|
||||
'@typescript-eslint/no-namespace': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
||||
'@typescript-eslint/no-non-null-assertion': 'error',
|
||||
'@typescript-eslint/no-require-imports': 'error',
|
||||
'@typescript-eslint/no-this-alias': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
||||
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
||||
'@typescript-eslint/no-unsafe-function-type': 'error',
|
||||
'no-unused-expressions': 'off',
|
||||
'@typescript-eslint/no-unused-expressions': 'error',
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
'no-useless-constructor': 'off',
|
||||
'@typescript-eslint/no-useless-constructor': 'error',
|
||||
'@typescript-eslint/no-wrapper-object-types': 'error',
|
||||
'@typescript-eslint/prefer-as-const': 'error',
|
||||
'@typescript-eslint/prefer-literal-enum-member': 'error',
|
||||
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
||||
'@typescript-eslint/triple-slash-reference': 'error',
|
||||
'@typescript-eslint/unified-signatures': 'error',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=strict.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"strict.js","sourceRoot":"","sources":["../../src/configs/strict.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,mCAAmC,EAAE;YACnC,OAAO;YACP,EAAE,wBAAwB,EAAE,EAAE,EAAE;SACjC;QACD,sBAAsB,EAAE,KAAK;QAC7B,yCAAyC,EAAE,OAAO;QAClD,6CAA6C,EAAE,OAAO;QACtD,sCAAsC,EAAE,OAAO;QAC/C,yCAAyC,EAAE,OAAO;QAClD,oCAAoC,EAAE,OAAO;QAC7C,gDAAgD,EAAE,OAAO;QACzD,wCAAwC,EAAE,OAAO;QACjD,yCAAyC,EAAE,OAAO;QAClD,mCAAmC,EAAE,OAAO;QAC5C,iCAAiC,EAAE,OAAO;QAC1C,4DAA4D,EAAE,OAAO;QACrE,wDAAwD,EAAE,OAAO;QACjE,0CAA0C,EAAE,OAAO;QACnD,uCAAuC,EAAE,OAAO;QAChD,kCAAkC,EAAE,OAAO;QAC3C,mDAAmD,EAAE,OAAO;QAC5D,kDAAkD,EAAE,OAAO;QAC3D,4CAA4C,EAAE,OAAO;QACrD,uBAAuB,EAAE,KAAK;QAC9B,0CAA0C,EAAE,OAAO;QACnD,gBAAgB,EAAE,KAAK;QACvB,mCAAmC,EAAE,OAAO;QAC5C,wBAAwB,EAAE,KAAK;QAC/B,2CAA2C,EAAE,OAAO;QACpD,4CAA4C,EAAE,OAAO;QACrD,oCAAoC,EAAE,OAAO;QAC7C,+CAA+C,EAAE,OAAO;QACxD,6CAA6C,EAAE,OAAO;QACtD,2CAA2C,EAAE,OAAO;QACpD,uCAAuC,EAAE,OAAO;KACjD;CAC6B,CAAC"}
|
||||
22
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic-type-checked-only.js
generated
vendored
Normal file
22
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic-type-checked-only.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate:configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/base', './configs/eslint-recommended'],
|
||||
rules: {
|
||||
'dot-notation': 'off',
|
||||
'@typescript-eslint/dot-notation': 'error',
|
||||
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
|
||||
'@typescript-eslint/prefer-find': 'error',
|
||||
'@typescript-eslint/prefer-includes': 'error',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
||||
'@typescript-eslint/prefer-optional-chain': 'error',
|
||||
'@typescript-eslint/prefer-regexp-exec': 'error',
|
||||
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=stylistic-type-checked-only.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic-type-checked-only.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic-type-checked-only.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stylistic-type-checked-only.js","sourceRoot":"","sources":["../../src/configs/stylistic-type-checked-only.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,cAAc,EAAE,KAAK;QACrB,iCAAiC,EAAE,OAAO;QAC1C,sDAAsD,EAAE,OAAO;QAC/D,gCAAgC,EAAE,OAAO;QACzC,oCAAoC,EAAE,OAAO;QAC7C,8CAA8C,EAAE,OAAO;QACvD,0CAA0C,EAAE,OAAO;QACnD,uCAAuC,EAAE,OAAO;QAChD,mDAAmD,EAAE,OAAO;KAC7D;CAC6B,CAAC"}
|
||||
36
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic-type-checked.js
generated
vendored
Normal file
36
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic-type-checked.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate:configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/base', './configs/eslint-recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
||||
'@typescript-eslint/array-type': 'error',
|
||||
'@typescript-eslint/ban-tslint-comment': 'error',
|
||||
'@typescript-eslint/class-literal-property-style': 'error',
|
||||
'@typescript-eslint/consistent-generic-constructors': 'error',
|
||||
'@typescript-eslint/consistent-indexed-object-style': 'error',
|
||||
'@typescript-eslint/consistent-type-assertions': 'error',
|
||||
'@typescript-eslint/consistent-type-definitions': 'error',
|
||||
'dot-notation': 'off',
|
||||
'@typescript-eslint/dot-notation': 'error',
|
||||
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
|
||||
'no-empty-function': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'error',
|
||||
'@typescript-eslint/no-inferrable-types': 'error',
|
||||
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
|
||||
'@typescript-eslint/prefer-find': 'error',
|
||||
'@typescript-eslint/prefer-for-of': 'error',
|
||||
'@typescript-eslint/prefer-function-type': 'error',
|
||||
'@typescript-eslint/prefer-includes': 'error',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'error',
|
||||
'@typescript-eslint/prefer-optional-chain': 'error',
|
||||
'@typescript-eslint/prefer-regexp-exec': 'error',
|
||||
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=stylistic-type-checked.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic-type-checked.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic-type-checked.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stylistic-type-checked.js","sourceRoot":"","sources":["../../src/configs/stylistic-type-checked.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,iDAAiD,EAAE,OAAO;QAC1D,+BAA+B,EAAE,OAAO;QACxC,uCAAuC,EAAE,OAAO;QAChD,iDAAiD,EAAE,OAAO;QAC1D,oDAAoD,EAAE,OAAO;QAC7D,oDAAoD,EAAE,OAAO;QAC7D,+CAA+C,EAAE,OAAO;QACxD,gDAAgD,EAAE,OAAO;QACzD,cAAc,EAAE,KAAK;QACrB,iCAAiC,EAAE,OAAO;QAC1C,oDAAoD,EAAE,OAAO;QAC7D,mBAAmB,EAAE,KAAK;QAC1B,sCAAsC,EAAE,OAAO;QAC/C,wCAAwC,EAAE,OAAO;QACjD,sDAAsD,EAAE,OAAO;QAC/D,gCAAgC,EAAE,OAAO;QACzC,kCAAkC,EAAE,OAAO;QAC3C,yCAAyC,EAAE,OAAO;QAClD,oCAAoC,EAAE,OAAO;QAC7C,8CAA8C,EAAE,OAAO;QACvD,0CAA0C,EAAE,OAAO;QACnD,uCAAuC,EAAE,OAAO;QAChD,mDAAmD,EAAE,OAAO;KAC7D;CAC6B,CAAC"}
|
||||
27
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic.js
generated
vendored
Normal file
27
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// SEE https://typescript-eslint.io/users/configs
|
||||
//
|
||||
// For developers working in the typescript-eslint monorepo:
|
||||
// You can regenerate it using `yarn generate:configs`
|
||||
module.exports = {
|
||||
extends: ['./configs/base', './configs/eslint-recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
||||
'@typescript-eslint/array-type': 'error',
|
||||
'@typescript-eslint/ban-tslint-comment': 'error',
|
||||
'@typescript-eslint/class-literal-property-style': 'error',
|
||||
'@typescript-eslint/consistent-generic-constructors': 'error',
|
||||
'@typescript-eslint/consistent-indexed-object-style': 'error',
|
||||
'@typescript-eslint/consistent-type-assertions': 'error',
|
||||
'@typescript-eslint/consistent-type-definitions': 'error',
|
||||
'@typescript-eslint/no-confusing-non-null-assertion': 'error',
|
||||
'no-empty-function': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'error',
|
||||
'@typescript-eslint/no-inferrable-types': 'error',
|
||||
'@typescript-eslint/prefer-for-of': 'error',
|
||||
'@typescript-eslint/prefer-function-type': 'error',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=stylistic.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/configs/stylistic.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"stylistic.js","sourceRoot":"","sources":["../../src/configs/stylistic.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,iDAAiD;AACjD,EAAE;AACF,4DAA4D;AAC5D,sDAAsD;AAItD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,iDAAiD,EAAE,OAAO;QAC1D,+BAA+B,EAAE,OAAO;QACxC,uCAAuC,EAAE,OAAO;QAChD,iDAAiD,EAAE,OAAO;QAC1D,oDAAoD,EAAE,OAAO;QAC7D,oDAAoD,EAAE,OAAO;QAC7D,+CAA+C,EAAE,OAAO;QACxD,gDAAgD,EAAE,OAAO;QACzD,oDAAoD,EAAE,OAAO;QAC7D,mBAAmB,EAAE,KAAK;QAC1B,sCAAsC,EAAE,OAAO;QAC/C,wCAAwC,EAAE,OAAO;QACjD,kCAAkC,EAAE,OAAO;QAC3C,yCAAyC,EAAE,OAAO;KACnD;CAC6B,CAAC"}
|
||||
45
node_modules/@typescript-eslint/eslint-plugin/dist/index.js
generated
vendored
Normal file
45
node_modules/@typescript-eslint/eslint-plugin/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
const all_1 = __importDefault(require("./configs/all"));
|
||||
const base_1 = __importDefault(require("./configs/base"));
|
||||
const disable_type_checked_1 = __importDefault(require("./configs/disable-type-checked"));
|
||||
const eslint_recommended_1 = __importDefault(require("./configs/eslint-recommended"));
|
||||
const recommended_1 = __importDefault(require("./configs/recommended"));
|
||||
const recommended_type_checked_1 = __importDefault(require("./configs/recommended-type-checked"));
|
||||
const recommended_type_checked_only_1 = __importDefault(require("./configs/recommended-type-checked-only"));
|
||||
const strict_1 = __importDefault(require("./configs/strict"));
|
||||
const strict_type_checked_1 = __importDefault(require("./configs/strict-type-checked"));
|
||||
const strict_type_checked_only_1 = __importDefault(require("./configs/strict-type-checked-only"));
|
||||
const stylistic_1 = __importDefault(require("./configs/stylistic"));
|
||||
const stylistic_type_checked_1 = __importDefault(require("./configs/stylistic-type-checked"));
|
||||
const stylistic_type_checked_only_1 = __importDefault(require("./configs/stylistic-type-checked-only"));
|
||||
const rules_1 = __importDefault(require("./rules"));
|
||||
// note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder
|
||||
const { name, version } = require('../package.json');
|
||||
module.exports = {
|
||||
configs: {
|
||||
all: all_1.default,
|
||||
base: base_1.default,
|
||||
'disable-type-checked': disable_type_checked_1.default,
|
||||
'eslint-recommended': eslint_recommended_1.default,
|
||||
recommended: recommended_1.default,
|
||||
/** @deprecated - please use "recommended-type-checked" instead. */
|
||||
'recommended-requiring-type-checking': recommended_type_checked_1.default,
|
||||
'recommended-type-checked': recommended_type_checked_1.default,
|
||||
'recommended-type-checked-only': recommended_type_checked_only_1.default,
|
||||
strict: strict_1.default,
|
||||
'strict-type-checked': strict_type_checked_1.default,
|
||||
'strict-type-checked-only': strict_type_checked_only_1.default,
|
||||
stylistic: stylistic_1.default,
|
||||
'stylistic-type-checked': stylistic_type_checked_1.default,
|
||||
'stylistic-type-checked-only': stylistic_type_checked_only_1.default,
|
||||
},
|
||||
meta: {
|
||||
name,
|
||||
version,
|
||||
},
|
||||
rules: rules_1.default,
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAEA,wDAAgC;AAChC,0DAAkC;AAClC,0FAAgE;AAChE,sFAA6D;AAC7D,wEAAgD;AAChD,kGAAwE;AACxE,4GAAiF;AACjF,8DAAsC;AACtC,wFAA8D;AAC9D,kGAAuE;AACvE,oEAA4C;AAC5C,8FAAoE;AACpE,wGAA6E;AAC7E,oDAA4B;AAE5B,sHAAsH;AACtH,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAGlD,CAAC;AAEF,iBAAS;IACP,OAAO,EAAE;QACP,GAAG,EAAH,aAAG;QACH,IAAI,EAAJ,cAAI;QACJ,sBAAsB,EAAE,8BAAkB;QAC1C,oBAAoB,EAAE,4BAAiB;QACvC,WAAW,EAAX,qBAAW;QACX,mEAAmE;QACnE,qCAAqC,EAAE,kCAAsB;QAC7D,0BAA0B,EAAE,kCAAsB;QAClD,+BAA+B,EAAE,uCAA0B;QAC3D,MAAM,EAAN,gBAAM;QACN,qBAAqB,EAAE,6BAAiB;QACxC,0BAA0B,EAAE,kCAAqB;QACjD,SAAS,EAAT,mBAAS;QACT,wBAAwB,EAAE,gCAAoB;QAC9C,6BAA6B,EAAE,qCAAwB;KACxD;IACD,IAAI,EAAE;QACJ,IAAI;QACJ,OAAO;KACR;IACD,KAAK,EAAL,eAAK;CACkB,CAAC"}
|
||||
130
node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js
generated
vendored
Normal file
130
node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js
generated
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'adjacent-overload-signatures',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Require that function overload signatures be consecutive',
|
||||
recommended: 'stylistic',
|
||||
},
|
||||
schema: [],
|
||||
messages: {
|
||||
adjacentSignature: 'All {{name}} signatures should be adjacent.',
|
||||
},
|
||||
},
|
||||
defaultOptions: [],
|
||||
create(context) {
|
||||
/**
|
||||
* Gets the name and attribute of the member being processed.
|
||||
* @param member the member being processed.
|
||||
* @returns the name and attribute of the member or null if it's a member not relevant to the rule.
|
||||
*/
|
||||
function getMemberMethod(member) {
|
||||
switch (member.type) {
|
||||
case utils_1.AST_NODE_TYPES.ExportDefaultDeclaration:
|
||||
case utils_1.AST_NODE_TYPES.ExportNamedDeclaration: {
|
||||
// export statements (e.g. export { a };)
|
||||
// have no declarations, so ignore them
|
||||
if (!member.declaration) {
|
||||
return null;
|
||||
}
|
||||
return getMemberMethod(member.declaration);
|
||||
}
|
||||
case utils_1.AST_NODE_TYPES.TSDeclareFunction:
|
||||
case utils_1.AST_NODE_TYPES.FunctionDeclaration: {
|
||||
const name = member.id?.name ?? null;
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
name,
|
||||
callSignature: false,
|
||||
type: util_1.MemberNameType.Normal,
|
||||
};
|
||||
}
|
||||
case utils_1.AST_NODE_TYPES.TSMethodSignature:
|
||||
return {
|
||||
...(0, util_1.getNameFromMember)(member, context.sourceCode),
|
||||
static: !!member.static,
|
||||
callSignature: false,
|
||||
};
|
||||
case utils_1.AST_NODE_TYPES.TSCallSignatureDeclaration:
|
||||
return {
|
||||
name: 'call',
|
||||
callSignature: true,
|
||||
type: util_1.MemberNameType.Normal,
|
||||
};
|
||||
case utils_1.AST_NODE_TYPES.TSConstructSignatureDeclaration:
|
||||
return {
|
||||
name: 'new',
|
||||
callSignature: false,
|
||||
type: util_1.MemberNameType.Normal,
|
||||
};
|
||||
case utils_1.AST_NODE_TYPES.MethodDefinition:
|
||||
return {
|
||||
...(0, util_1.getNameFromMember)(member, context.sourceCode),
|
||||
static: !!member.static,
|
||||
callSignature: false,
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function isSameMethod(method1, method2) {
|
||||
return (!!method2 &&
|
||||
method1.name === method2.name &&
|
||||
method1.static === method2.static &&
|
||||
method1.callSignature === method2.callSignature &&
|
||||
method1.type === method2.type);
|
||||
}
|
||||
function getMembers(node) {
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.ClassBody:
|
||||
case utils_1.AST_NODE_TYPES.Program:
|
||||
case utils_1.AST_NODE_TYPES.TSModuleBlock:
|
||||
case utils_1.AST_NODE_TYPES.TSInterfaceBody:
|
||||
case utils_1.AST_NODE_TYPES.BlockStatement:
|
||||
return node.body;
|
||||
case utils_1.AST_NODE_TYPES.TSTypeLiteral:
|
||||
return node.members;
|
||||
}
|
||||
}
|
||||
function checkBodyForOverloadMethods(node) {
|
||||
const members = getMembers(node);
|
||||
let lastMethod = null;
|
||||
const seenMethods = [];
|
||||
members.forEach(member => {
|
||||
const method = getMemberMethod(member);
|
||||
if (method == null) {
|
||||
lastMethod = null;
|
||||
return;
|
||||
}
|
||||
const index = seenMethods.findIndex(seenMethod => isSameMethod(method, seenMethod));
|
||||
if (index > -1 && !isSameMethod(method, lastMethod)) {
|
||||
context.report({
|
||||
node: member,
|
||||
messageId: 'adjacentSignature',
|
||||
data: {
|
||||
name: `${method.static ? 'static ' : ''}${method.name}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
else if (index === -1) {
|
||||
seenMethods.push(method);
|
||||
}
|
||||
lastMethod = method;
|
||||
});
|
||||
}
|
||||
return {
|
||||
ClassBody: checkBodyForOverloadMethods,
|
||||
Program: checkBodyForOverloadMethods,
|
||||
TSModuleBlock: checkBodyForOverloadMethods,
|
||||
TSTypeLiteral: checkBodyForOverloadMethods,
|
||||
TSInterfaceBody: checkBodyForOverloadMethods,
|
||||
BlockStatement: checkBodyForOverloadMethods,
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=adjacent-overload-signatures.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"adjacent-overload-signatures.js","sourceRoot":"","sources":["../../src/rules/adjacent-overload-signatures.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAAwE;AAmBxE,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,0DAA0D;YACvE,WAAW,EAAE,WAAW;SACzB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,iBAAiB,EAAE,6CAA6C;SACjE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QAQZ;;;;WAIG;QACH,SAAS,eAAe,CACtB,MAAkC;YAElC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;gBACpB,KAAK,sBAAc,CAAC,wBAAwB,CAAC;gBAC7C,KAAK,sBAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC;oBAC3C,yCAAyC;oBACzC,uCAAuC;oBACvC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;wB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M,EAAE,UAAU,CAAC,EAAE,CAAC;oBACpD,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,MAAM;wBACZ,SAAS,EAAE,mBAAmB;wBAC9B,IAAI,EAAE;4BACJ,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE;yBACxD;qBACF,CAAC,CAAC;gBACL,CAAC;qBAAM,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;oBACxB,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC3B,CAAC;gBAED,UAAU,GAAG,MAAM,CAAC;YACtB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,SAAS,EAAE,2BAA2B;YACtC,OAAO,EAAE,2BAA2B;YACpC,aAAa,EAAE,2BAA2B;YAC1C,aAAa,EAAE,2BAA2B;YAC1C,eAAe,EAAE,2BAA2B;YAC5C,cAAc,EAAE,2BAA2B;SAC5C,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
229
node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js
generated
vendored
Normal file
229
node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js
generated
vendored
Normal file
@@ -0,0 +1,229 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
/**
|
||||
* Check whatever node can be considered as simple
|
||||
* @param node the node to be evaluated.
|
||||
*/
|
||||
function isSimpleType(node) {
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.Identifier:
|
||||
case utils_1.AST_NODE_TYPES.TSAnyKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSBooleanKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSNeverKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSNumberKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSBigIntKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSObjectKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSStringKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSSymbolKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSUnknownKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSVoidKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSNullKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSArrayType:
|
||||
case utils_1.AST_NODE_TYPES.TSUndefinedKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSThisType:
|
||||
case utils_1.AST_NODE_TYPES.TSQualifiedName:
|
||||
return true;
|
||||
case utils_1.AST_NODE_TYPES.TSTypeReference:
|
||||
if (node.typeName.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
node.typeName.name === 'Array') {
|
||||
if (!node.typeArguments) {
|
||||
return true;
|
||||
}
|
||||
if (node.typeArguments.params.length === 1) {
|
||||
return isSimpleType(node.typeArguments.params[0]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (node.typeArguments) {
|
||||
return false;
|
||||
}
|
||||
return isSimpleType(node.typeName);
|
||||
}
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Check if node needs parentheses
|
||||
* @param node the node to be evaluated.
|
||||
*/
|
||||
function typeNeedsParentheses(node) {
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.TSTypeReference:
|
||||
return typeNeedsParentheses(node.typeName);
|
||||
case utils_1.AST_NODE_TYPES.TSUnionType:
|
||||
case utils_1.AST_NODE_TYPES.TSFunctionType:
|
||||
case utils_1.AST_NODE_TYPES.TSIntersectionType:
|
||||
case utils_1.AST_NODE_TYPES.TSTypeOperator:
|
||||
case utils_1.AST_NODE_TYPES.TSInferType:
|
||||
case utils_1.AST_NODE_TYPES.TSConstructorType:
|
||||
return true;
|
||||
case utils_1.AST_NODE_TYPES.Identifier:
|
||||
return node.name === 'ReadonlyArray';
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'array-type',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Require consistently using either `T[]` or `Array<T>` for arrays',
|
||||
recommended: 'stylistic',
|
||||
},
|
||||
fixable: 'code',
|
||||
messages: {
|
||||
errorStringGeneric: "Array type using '{{readonlyPrefix}}{{type}}[]' is forbidden. Use '{{className}}<{{type}}>' instead.",
|
||||
errorStringArray: "Array type using '{{className}}<{{type}}>' is forbidden. Use '{{readonlyPrefix}}{{type}}[]' instead.",
|
||||
errorStringArrayReadonly: "Array type using '{{className}}<{{type}}>' is forbidden. Use '{{readonlyPrefix}}{{type}}' instead.",
|
||||
errorStringArraySimple: "Array type using '{{className}}<{{type}}>' is forbidden for simple types. Use '{{readonlyPrefix}}{{type}}[]' instead.",
|
||||
errorStringGenericSimple: "Array type using '{{readonlyPrefix}}{{type}}[]' is forbidden for non-simple types. Use '{{className}}<{{type}}>' instead.",
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
$defs: {
|
||||
arrayOption: {
|
||||
type: 'string',
|
||||
enum: ['array', 'generic', 'array-simple'],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
default: {
|
||||
$ref: '#/items/0/$defs/arrayOption',
|
||||
description: 'The array type expected for mutable cases.',
|
||||
},
|
||||
readonly: {
|
||||
$ref: '#/items/0/$defs/arrayOption',
|
||||
description: 'The array type expected for readonly cases. If omitted, the value for `default` will be used.',
|
||||
},
|
||||
},
|
||||
type: 'object',
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
default: 'array',
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
const defaultOption = options.default;
|
||||
const readonlyOption = options.readonly ?? defaultOption;
|
||||
/**
|
||||
* @param node the node to be evaluated.
|
||||
*/
|
||||
function getMessageType(node) {
|
||||
if (isSimpleType(node)) {
|
||||
return context.sourceCode.getText(node);
|
||||
}
|
||||
return 'T';
|
||||
}
|
||||
return {
|
||||
TSArrayType(node) {
|
||||
const isReadonly = node.parent.type === utils_1.AST_NODE_TYPES.TSTypeOperator &&
|
||||
node.parent.operator === 'readonly';
|
||||
const currentOption = isReadonly ? readonlyOption : defaultOption;
|
||||
if (currentOption === 'array' ||
|
||||
(currentOption === 'array-simple' && isSimpleType(node.elementType))) {
|
||||
return;
|
||||
}
|
||||
const messageId = currentOption === 'generic'
|
||||
? 'errorStringGeneric'
|
||||
: 'errorStringGenericSimple';
|
||||
const errorNode = isReadonly ? node.parent : node;
|
||||
context.report({
|
||||
node: errorNode,
|
||||
messageId,
|
||||
data: {
|
||||
className: isReadonly ? 'ReadonlyArray' : 'Array',
|
||||
readonlyPrefix: isReadonly ? 'readonly ' : '',
|
||||
type: getMessageType(node.elementType),
|
||||
},
|
||||
fix(fixer) {
|
||||
const typeNode = node.elementType;
|
||||
const arrayType = isReadonly ? 'ReadonlyArray' : 'Array';
|
||||
return [
|
||||
fixer.replaceTextRange([errorNode.range[0], typeNode.range[0]], `${arrayType}<`),
|
||||
fixer.replaceTextRange([typeNode.range[1], errorNode.range[1]], '>'),
|
||||
];
|
||||
},
|
||||
});
|
||||
},
|
||||
TSTypeReference(node) {
|
||||
if (node.typeName.type !== utils_1.AST_NODE_TYPES.Identifier ||
|
||||
!(node.typeName.name === 'Array' ||
|
||||
node.typeName.name === 'ReadonlyArray' ||
|
||||
node.typeName.name === 'Readonly') ||
|
||||
(node.typeName.name === 'Readonly' &&
|
||||
node.typeArguments?.params[0].type !== utils_1.AST_NODE_TYPES.TSArrayType)) {
|
||||
return;
|
||||
}
|
||||
const isReadonlyWithGenericArrayType = node.typeName.name === 'Readonly' &&
|
||||
node.typeArguments?.params[0].type === utils_1.AST_NODE_TYPES.TSArrayType;
|
||||
const isReadonlyArrayType = node.typeName.name === 'ReadonlyArray' ||
|
||||
isReadonlyWithGenericArrayType;
|
||||
const currentOption = isReadonlyArrayType
|
||||
? readonlyOption
|
||||
: defaultOption;
|
||||
if (currentOption === 'generic') {
|
||||
return;
|
||||
}
|
||||
const readonlyPrefix = isReadonlyArrayType ? 'readonly ' : '';
|
||||
const typeParams = node.typeArguments?.params;
|
||||
const messageId = currentOption === 'array'
|
||||
? isReadonlyWithGenericArrayType
|
||||
? 'errorStringArrayReadonly'
|
||||
: 'errorStringArray'
|
||||
: 'errorStringArraySimple';
|
||||
if (!typeParams || typeParams.length === 0) {
|
||||
// Create an 'any' array
|
||||
context.report({
|
||||
node,
|
||||
messageId,
|
||||
data: {
|
||||
className: isReadonlyArrayType ? 'ReadonlyArray' : 'Array',
|
||||
readonlyPrefix,
|
||||
type: 'any',
|
||||
},
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(node, `${readonlyPrefix}any[]`);
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (typeParams.length !== 1 ||
|
||||
(currentOption === 'array-simple' && !isSimpleType(typeParams[0]))) {
|
||||
return;
|
||||
}
|
||||
const type = typeParams[0];
|
||||
const typeParens = typeNeedsParentheses(type);
|
||||
const parentParens = readonlyPrefix &&
|
||||
node.parent.type === utils_1.AST_NODE_TYPES.TSArrayType &&
|
||||
!(0, util_1.isParenthesized)(node.parent.elementType, context.sourceCode);
|
||||
const start = `${parentParens ? '(' : ''}${readonlyPrefix}${typeParens ? '(' : ''}`;
|
||||
const end = `${typeParens ? ')' : ''}${isReadonlyWithGenericArrayType ? '' : `[]`}${parentParens ? ')' : ''}`;
|
||||
context.report({
|
||||
node,
|
||||
messageId,
|
||||
data: {
|
||||
className: isReadonlyArrayType ? node.typeName.name : 'Array',
|
||||
readonlyPrefix,
|
||||
type: getMessageType(type),
|
||||
},
|
||||
fix(fixer) {
|
||||
return [
|
||||
fixer.replaceTextRange([node.range[0], type.range[0]], start),
|
||||
fixer.replaceTextRange([type.range[1], node.range[1]], end),
|
||||
];
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=array-type.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
74
node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js
generated
vendored
Normal file
74
node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'await-thenable',
|
||||
meta: {
|
||||
docs: {
|
||||
description: 'Disallow awaiting a value that is not a Thenable',
|
||||
recommended: 'recommended',
|
||||
requiresTypeChecking: true,
|
||||
},
|
||||
hasSuggestions: true,
|
||||
messages: {
|
||||
await: 'Unexpected `await` of a non-Promise (non-"Thenable") value.',
|
||||
removeAwait: 'Remove unnecessary `await`.',
|
||||
},
|
||||
schema: [],
|
||||
type: 'problem',
|
||||
},
|
||||
defaultOptions: [],
|
||||
create(context) {
|
||||
const services = (0, util_1.getParserServices)(context);
|
||||
const checker = services.program.getTypeChecker();
|
||||
return {
|
||||
AwaitExpression(node) {
|
||||
const type = services.getTypeAtLocation(node.argument);
|
||||
if ((0, util_1.isTypeAnyType)(type) || (0, util_1.isTypeUnknownType)(type)) {
|
||||
return;
|
||||
}
|
||||
const originalNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
if (!tsutils.isThenableType(checker, originalNode.expression, type)) {
|
||||
context.report({
|
||||
messageId: 'await',
|
||||
node,
|
||||
suggest: [
|
||||
{
|
||||
messageId: 'removeAwait',
|
||||
fix(fixer) {
|
||||
const awaitKeyword = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(node, util_1.isAwaitKeyword), util_1.NullThrowsReasons.MissingToken('await', 'await expression'));
|
||||
return fixer.remove(awaitKeyword);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=await-thenable.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"await-thenable.js","sourceRoot":"","sources":["../../src/rules/await-thenable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAwC;AAExC,kCAQiB;AAEjB,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE;QACJ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AC;gCACpC,CAAC;6BACF;yBACF;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
178
node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js
generated
vendored
Normal file
178
node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
const defaultMinimumDescriptionLength = 3;
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'ban-ts-comment',
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Disallow `@ts-<directive>` comments or require descriptions after directives',
|
||||
recommended: {
|
||||
recommended: true,
|
||||
strict: [{ minimumDescriptionLength: 10 }],
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
tsDirectiveComment: 'Do not use "@ts-{{directive}}" because it alters compilation errors.',
|
||||
tsIgnoreInsteadOfExpectError: 'Use "@ts-expect-error" instead of "@ts-ignore", as "@ts-ignore" will do nothing if the following line is error-free.',
|
||||
tsDirectiveCommentRequiresDescription: 'Include a description after the "@ts-{{directive}}" directive to explain why the @ts-{{directive}} is necessary. The description must be {{minimumDescriptionLength}} characters or longer.',
|
||||
tsDirectiveCommentDescriptionNotMatchPattern: 'The description for the "@ts-{{directive}}" directive must match the {{format}} format.',
|
||||
replaceTsIgnoreWithTsExpectError: 'Replace "@ts-ignore" with "@ts-expect-error".',
|
||||
},
|
||||
hasSuggestions: true,
|
||||
schema: [
|
||||
{
|
||||
$defs: {
|
||||
directiveConfigSchema: {
|
||||
oneOf: [
|
||||
{
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['allow-with-description'],
|
||||
},
|
||||
{
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
descriptionFormat: { type: 'string' },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
properties: {
|
||||
'ts-expect-error': { $ref: '#/items/0/$defs/directiveConfigSchema' },
|
||||
'ts-ignore': { $ref: '#/items/0/$defs/directiveConfigSchema' },
|
||||
'ts-nocheck': { $ref: '#/items/0/$defs/directiveConfigSchema' },
|
||||
'ts-check': { $ref: '#/items/0/$defs/directiveConfigSchema' },
|
||||
minimumDescriptionLength: {
|
||||
type: 'number',
|
||||
default: defaultMinimumDescriptionLength,
|
||||
},
|
||||
},
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
'ts-expect-error': 'allow-with-description',
|
||||
'ts-ignore': true,
|
||||
'ts-nocheck': true,
|
||||
'ts-check': false,
|
||||
minimumDescriptionLength: defaultMinimumDescriptionLength,
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
// https://github.com/microsoft/TypeScript/blob/6f1ad5ad8bec5671f7e951a3524b62d82ec4be68/src/compiler/parser.ts#L10591
|
||||
const singleLinePragmaRegEx = /^\/\/\/?\s*@ts-(?<directive>check|nocheck)(?<description>.*)$/;
|
||||
/*
|
||||
The regex used are taken from the ones used in the official TypeScript repo -
|
||||
https://github.com/microsoft/TypeScript/blob/6f1ad5ad8bec5671f7e951a3524b62d82ec4be68/src/compiler/scanner.ts#L340-L348
|
||||
*/
|
||||
const commentDirectiveRegExSingleLine = /^\/*\s*@ts-(?<directive>expect-error|ignore)(?<description>.*)/;
|
||||
const commentDirectiveRegExMultiLine = /^\s*(?:\/|\*)*\s*@ts-(?<directive>expect-error|ignore)(?<description>.*)/;
|
||||
const descriptionFormats = new Map();
|
||||
for (const directive of [
|
||||
'ts-expect-error',
|
||||
'ts-ignore',
|
||||
'ts-nocheck',
|
||||
'ts-check',
|
||||
]) {
|
||||
const option = options[directive];
|
||||
if (typeof option === 'object' && option.descriptionFormat) {
|
||||
descriptionFormats.set(directive, new RegExp(option.descriptionFormat));
|
||||
}
|
||||
}
|
||||
function execDirectiveRegEx(regex, str) {
|
||||
const match = regex.exec(str);
|
||||
if (!match) {
|
||||
return null;
|
||||
}
|
||||
const { directive, description } = (0, util_1.nullThrows)(match.groups, 'RegExp should contain groups');
|
||||
return {
|
||||
directive: (0, util_1.nullThrows)(directive, 'RegExp should contain "directive" group'),
|
||||
description: (0, util_1.nullThrows)(description, 'RegExp should contain "description" group'),
|
||||
};
|
||||
}
|
||||
function findDirectiveInComment(comment) {
|
||||
if (comment.type === utils_1.AST_TOKEN_TYPES.Line) {
|
||||
const matchedPragma = execDirectiveRegEx(singleLinePragmaRegEx, `//${comment.value}`);
|
||||
if (matchedPragma) {
|
||||
return matchedPragma;
|
||||
}
|
||||
return execDirectiveRegEx(commentDirectiveRegExSingleLine, comment.value);
|
||||
}
|
||||
const commentLines = comment.value.split('\n');
|
||||
return execDirectiveRegEx(commentDirectiveRegExMultiLine, commentLines[commentLines.length - 1]);
|
||||
}
|
||||
return {
|
||||
Program() {
|
||||
const comments = context.sourceCode.getAllComments();
|
||||
comments.forEach(comment => {
|
||||
const match = findDirectiveInComment(comment);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
const { directive, description } = match;
|
||||
const fullDirective = `ts-${directive}`;
|
||||
const option = options[fullDirective];
|
||||
if (option === true) {
|
||||
if (directive === 'ignore') {
|
||||
// Special case to suggest @ts-expect-error instead of @ts-ignore
|
||||
context.report({
|
||||
node: comment,
|
||||
messageId: 'tsIgnoreInsteadOfExpectError',
|
||||
suggest: [
|
||||
{
|
||||
messageId: 'replaceTsIgnoreWithTsExpectError',
|
||||
fix(fixer) {
|
||||
const commentText = comment.value.replace(/@ts-ignore/, '@ts-expect-error');
|
||||
return fixer.replaceText(comment, comment.type === utils_1.AST_TOKEN_TYPES.Line
|
||||
? `//${commentText}`
|
||||
: `/*${commentText}*/`);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
else {
|
||||
context.report({
|
||||
data: { directive },
|
||||
node: comment,
|
||||
messageId: 'tsDirectiveComment',
|
||||
});
|
||||
}
|
||||
}
|
||||
if (option === 'allow-with-description' ||
|
||||
(typeof option === 'object' && option.descriptionFormat)) {
|
||||
const { minimumDescriptionLength } = options;
|
||||
const format = descriptionFormats.get(fullDirective);
|
||||
if ((0, util_1.getStringLength)(description.trim()) <
|
||||
(0, util_1.nullThrows)(minimumDescriptionLength, 'Expected minimumDescriptionLength to be set')) {
|
||||
context.report({
|
||||
data: { directive, minimumDescriptionLength },
|
||||
node: comment,
|
||||
messageId: 'tsDirectiveCommentRequiresDescription',
|
||||
});
|
||||
}
|
||||
else if (format && !format.test(description)) {
|
||||
context.report({
|
||||
data: { directive, format: format.source },
|
||||
node: comment,
|
||||
messageId: 'tsDirectiveCommentDescriptionNotMatchPattern',
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=ban-ts-comment.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ban-ts-comment.js","sourceRoot":"","sources":["../../src/rules/ban-ts-comment.ts"],"names":[],"mappings":";;AACA,oDAA2D;AAE3D,kCAAkE;AAelE,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAc1C,kBAAe,IAAA,iBAAU,EAAwB;IAC/C,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,8EAA8E;YAChF,WAAW,EAAE;gBACX,WAAW,EAAE,IAAI;gBACjB,MAAM,EAAE,CAAC,EAAE,wBAAwB,EAAE,EAAE,EAAE,CAAC;aAC3C;SAC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,CAAC;qCACF;iCACF;6BACF,CAAC,CAAC;wBACL,CAAC;6BAAM,CAAC;4BACN,OAAO,CAAC,MAAM,CAAC;gCACb,IAAI,EAAE,EAAE,SAAS,EAAE;gCACnB,IAAI,EAAE,OAAO;gCACb,SAAS,EAAE,oBAAoB;6BAChC,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;oBAED,IACE,MAAM,KAAK,wBAAwB;wBACnC,CAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,iBAAiB,CAAC,EACxD,CAAC;wBACD,MAAM,EAAE,wBAAwB,EAAE,GAAG,OAAO,CAAC;wBAC7C,MAAM,MAAM,GAAG,kBAAkB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;wBACrD,IACE,IAAA,sBAAe,EAAC,WAAW,CAAC,IAAI,EAAE,CAAC;4BACnC,IAAA,iBAAU,EACR,wBAAwB,EACxB,6CAA6C,CAC9C,EACD,CAAC;4BACD,OAAO,CAAC,MAAM,CAAC;gCACb,IAAI,EAAE,EAAE,SAAS,EAAE,wBAAwB,EAAE;gCAC7C,IAAI,EAAE,OAAO;gCACb,SAAS,EAAE,uCAAuC;6BACnD,CAAC,CAAC;wBACL,CAAC;6BAAM,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;4BAC/C,OAAO,CAAC,MAAM,CAAC;gCACb,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;gCAC1C,IAAI,EAAE,OAAO;gCACb,SAAS,EAAE,8CAA8C;6BAC1D,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
54
node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-tslint-comment.js
generated
vendored
Normal file
54
node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-tslint-comment.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
// tslint regex
|
||||
// https://github.com/palantir/tslint/blob/95d9d958833fd9dc0002d18cbe34db20d0fbf437/src/enableDisableRules.ts#L32
|
||||
const ENABLE_DISABLE_REGEX = /^\s*tslint:(enable|disable)(?:-(line|next-line))?(:|\s|$)/;
|
||||
const toText = (text, type) => type === utils_1.AST_TOKEN_TYPES.Line
|
||||
? ['//', text.trim()].join(' ')
|
||||
: ['/*', text.trim(), '*/'].join(' ');
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'ban-tslint-comment',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Disallow `// tslint:<rule-flag>` comments',
|
||||
recommended: 'stylistic',
|
||||
},
|
||||
messages: {
|
||||
commentDetected: 'tslint comment detected: "{{ text }}"',
|
||||
},
|
||||
schema: [],
|
||||
fixable: 'code',
|
||||
},
|
||||
defaultOptions: [],
|
||||
create: context => {
|
||||
return {
|
||||
Program() {
|
||||
const comments = context.sourceCode.getAllComments();
|
||||
comments.forEach(c => {
|
||||
if (ENABLE_DISABLE_REGEX.test(c.value)) {
|
||||
context.report({
|
||||
data: { text: toText(c.value, c.type) },
|
||||
node: c,
|
||||
messageId: 'commentDetected',
|
||||
fix(fixer) {
|
||||
const rangeStart = context.sourceCode.getIndexFromLoc({
|
||||
column: c.loc.start.column > 0 ? c.loc.start.column - 1 : 0,
|
||||
line: c.loc.start.line,
|
||||
});
|
||||
const rangeEnd = context.sourceCode.getIndexFromLoc({
|
||||
column: c.loc.end.column,
|
||||
line: c.loc.end.line,
|
||||
});
|
||||
return fixer.removeRange([rangeStart, rangeEnd + 1]);
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=ban-tslint-comment.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-tslint-comment.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-tslint-comment.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ban-tslint-comment.js","sourceRoot":"","sources":["../../src/rules/ban-tslint-comment.ts"],"names":[],"mappings":";;AAAA,oDAA2D;AAE3D,kCAAqC;AAErC,eAAe;AACf,iHAAiH;AACjH,MAAM,oBAAoB,GACxB,2DAA2D,CAAC;AAE9D,MAAM,MAAM,GAAG,CACb,IAAY,EACZ,IAAkD,EAC1C,EAAE,CACV,IAAI,KAAK,uBAAe,CAAC,IAAI;IAC3B,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;IAC/B,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE1C,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,2CAA2C;YACxD,WAAW,EAAE,WAAW;SACzB;QACD,QAAQ,EAAE;YACR,eAAe,EAAE,uCAAuC;SACzD;QACD,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,MAAM;KAChB;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,EAAE,OAAO,CAAC,EAAE;QAChB,OAAO;YACL,OAAO;gBACL,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;gBACrD,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;oBACnB,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;wBACvC,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE;4BACvC,IAAI,EAAE,CAAC;4BACP,SAAS,EAAE,iBAAiB;4BAC5B,GAAG,CAAC,KAAK;gCACP,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC;oCACpD,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;oCAC3D,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI;iCACvB,CAAC,CAAC;gCACH,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC;oCAClD,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM;oCACxB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI;iCACrB,CAAC,CAAC;gCACH,OAAO,KAAK,CAAC,WAAW,CAAC,CAAC,UAAU,EAAE,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC;4BACvD,CAAC;yBACF,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
162
node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-literal-property-style.js
generated
vendored
Normal file
162
node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-literal-property-style.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
const printNodeModifiers = (node, final) => `${node.accessibility ?? ''}${node.static ? ' static' : ''} ${final} `.trimStart();
|
||||
const isSupportedLiteral = (node) => {
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.Literal:
|
||||
return true;
|
||||
case utils_1.AST_NODE_TYPES.TaggedTemplateExpression:
|
||||
return node.quasi.quasis.length === 1;
|
||||
case utils_1.AST_NODE_TYPES.TemplateLiteral:
|
||||
return node.quasis.length === 1;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'class-literal-property-style',
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Enforce that literals on classes are exposed in a consistent style',
|
||||
recommended: 'stylistic',
|
||||
},
|
||||
hasSuggestions: true,
|
||||
messages: {
|
||||
preferFieldStyle: 'Literals should be exposed using readonly fields.',
|
||||
preferFieldStyleSuggestion: 'Replace the literals with readonly fields.',
|
||||
preferGetterStyle: 'Literals should be exposed using getters.',
|
||||
preferGetterStyleSuggestion: 'Replace the literals with getters.',
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['fields', 'getters'],
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: ['fields'],
|
||||
create(context, [style]) {
|
||||
const propertiesInfoStack = [];
|
||||
function getStringValue(node) {
|
||||
return (0, util_1.getStaticStringValue)(node) ?? context.sourceCode.getText(node);
|
||||
}
|
||||
function enterClassBody() {
|
||||
propertiesInfoStack.push({
|
||||
properties: [],
|
||||
excludeSet: new Set(),
|
||||
});
|
||||
}
|
||||
function exitClassBody() {
|
||||
const { properties, excludeSet } = (0, util_1.nullThrows)(propertiesInfoStack.pop(), 'Stack should exist on class exit');
|
||||
properties.forEach(node => {
|
||||
const { value } = node;
|
||||
if (!value || !isSupportedLiteral(value)) {
|
||||
return;
|
||||
}
|
||||
const name = getStringValue(node.key);
|
||||
if (excludeSet.has(name)) {
|
||||
return;
|
||||
}
|
||||
context.report({
|
||||
node: node.key,
|
||||
messageId: 'preferGetterStyle',
|
||||
suggest: [
|
||||
{
|
||||
messageId: 'preferGetterStyleSuggestion',
|
||||
fix(fixer) {
|
||||
const name = context.sourceCode.getText(node.key);
|
||||
let text = '';
|
||||
text += printNodeModifiers(node, 'get');
|
||||
text += node.computed ? `[${name}]` : name;
|
||||
text += `() { return ${context.sourceCode.getText(value)}; }`;
|
||||
return fixer.replaceText(node, text);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
}
|
||||
function excludeAssignedProperty(node) {
|
||||
if ((0, util_1.isAssignee)(node)) {
|
||||
const { excludeSet } = propertiesInfoStack[propertiesInfoStack.length - 1];
|
||||
const name = (0, util_1.getStaticStringValue)(node.property) ??
|
||||
context.sourceCode.getText(node.property);
|
||||
if (name) {
|
||||
excludeSet.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
...(style === 'fields' && {
|
||||
MethodDefinition(node) {
|
||||
if (node.kind !== 'get' ||
|
||||
!node.value.body ||
|
||||
node.value.body.body.length === 0) {
|
||||
return;
|
||||
}
|
||||
const [statement] = node.value.body.body;
|
||||
if (statement.type !== utils_1.AST_NODE_TYPES.ReturnStatement) {
|
||||
return;
|
||||
}
|
||||
const { argument } = statement;
|
||||
if (!argument || !isSupportedLiteral(argument)) {
|
||||
return;
|
||||
}
|
||||
const name = getStringValue(node.key);
|
||||
const hasDuplicateKeySetter = node.parent.body.some(element => {
|
||||
return (element.type === utils_1.AST_NODE_TYPES.MethodDefinition &&
|
||||
element.kind === 'set' &&
|
||||
getStringValue(element.key) === name);
|
||||
});
|
||||
if (hasDuplicateKeySetter) {
|
||||
return;
|
||||
}
|
||||
context.report({
|
||||
node: node.key,
|
||||
messageId: 'preferFieldStyle',
|
||||
suggest: [
|
||||
{
|
||||
messageId: 'preferFieldStyleSuggestion',
|
||||
fix(fixer) {
|
||||
const name = context.sourceCode.getText(node.key);
|
||||
let text = '';
|
||||
text += printNodeModifiers(node, 'readonly');
|
||||
text += node.computed ? `[${name}]` : name;
|
||||
text += ` = ${context.sourceCode.getText(argument)};`;
|
||||
return fixer.replaceText(node, text);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
}),
|
||||
...(style === 'getters' && {
|
||||
ClassBody: enterClassBody,
|
||||
'ClassBody:exit': exitClassBody,
|
||||
'MethodDefinition[kind="constructor"] ThisExpression'(node) {
|
||||
if (node.parent.type === utils_1.AST_NODE_TYPES.MemberExpression) {
|
||||
let parent = node.parent;
|
||||
while (!(0, util_1.isFunction)(parent)) {
|
||||
parent = parent.parent;
|
||||
}
|
||||
if (parent.parent.type === utils_1.AST_NODE_TYPES.MethodDefinition &&
|
||||
parent.parent.kind === 'constructor') {
|
||||
excludeAssignedProperty(node.parent);
|
||||
}
|
||||
}
|
||||
},
|
||||
PropertyDefinition(node) {
|
||||
if (!node.readonly || node.declare) {
|
||||
return;
|
||||
}
|
||||
const { properties } = propertiesInfoStack[propertiesInfoStack.length - 1];
|
||||
properties.push(node);
|
||||
},
|
||||
}),
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=class-literal-property-style.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-literal-property-style.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-literal-property-style.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
209
node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-methods-use-this.js
generated
vendored
Normal file
209
node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-methods-use-this.js
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'class-methods-use-this',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce that class methods utilize `this`',
|
||||
extendsBaseRule: true,
|
||||
requiresTypeChecking: false,
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
exceptMethods: {
|
||||
type: 'array',
|
||||
description: 'Allows specified method names to be ignored with this rule',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
enforceForClassFields: {
|
||||
type: 'boolean',
|
||||
description: 'Enforces that functions used as instance field initializers utilize `this`',
|
||||
default: true,
|
||||
},
|
||||
ignoreOverrideMethods: {
|
||||
type: 'boolean',
|
||||
description: 'Ignore members marked with the `override` modifier',
|
||||
},
|
||||
ignoreClassesThatImplementAnInterface: {
|
||||
oneOf: [
|
||||
{
|
||||
type: 'boolean',
|
||||
description: 'Ignore all classes that implement an interface',
|
||||
},
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['public-fields'],
|
||||
description: 'Ignore only the public fields of classes that implement an interface',
|
||||
},
|
||||
],
|
||||
description: 'Ignore classes that specifically implement some interface',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
messages: {
|
||||
missingThis: "Expected 'this' to be used by class {{name}}.",
|
||||
},
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
enforceForClassFields: true,
|
||||
exceptMethods: [],
|
||||
ignoreClassesThatImplementAnInterface: false,
|
||||
ignoreOverrideMethods: false,
|
||||
},
|
||||
],
|
||||
create(context, [{ enforceForClassFields, exceptMethods: exceptMethodsRaw, ignoreClassesThatImplementAnInterface, ignoreOverrideMethods, },]) {
|
||||
const exceptMethods = new Set(exceptMethodsRaw);
|
||||
let stack;
|
||||
function pushContext(member) {
|
||||
if (member?.parent.type === utils_1.AST_NODE_TYPES.ClassBody) {
|
||||
stack = {
|
||||
member,
|
||||
class: member.parent.parent,
|
||||
usesThis: false,
|
||||
parent: stack,
|
||||
};
|
||||
}
|
||||
else {
|
||||
stack = {
|
||||
member: null,
|
||||
class: null,
|
||||
usesThis: false,
|
||||
parent: stack,
|
||||
};
|
||||
}
|
||||
}
|
||||
function enterFunction(node) {
|
||||
if (node.parent.type === utils_1.AST_NODE_TYPES.MethodDefinition ||
|
||||
node.parent.type === utils_1.AST_NODE_TYPES.PropertyDefinition) {
|
||||
pushContext(node.parent);
|
||||
}
|
||||
else {
|
||||
pushContext();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Pop `this` used flag from the stack.
|
||||
*/
|
||||
function popContext() {
|
||||
const oldStack = stack;
|
||||
stack = stack?.parent;
|
||||
return oldStack;
|
||||
}
|
||||
function isPublicField(accessibility) {
|
||||
if (!accessibility || accessibility === 'public') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Check if the node is an instance method not excluded by config
|
||||
*/
|
||||
function isIncludedInstanceMethod(node) {
|
||||
if (node.static ||
|
||||
(node.type === utils_1.AST_NODE_TYPES.MethodDefinition &&
|
||||
node.kind === 'constructor') ||
|
||||
(node.type === utils_1.AST_NODE_TYPES.PropertyDefinition &&
|
||||
!enforceForClassFields)) {
|
||||
return false;
|
||||
}
|
||||
if (node.computed || exceptMethods.size === 0) {
|
||||
return true;
|
||||
}
|
||||
const hashIfNeeded = node.key.type === utils_1.AST_NODE_TYPES.PrivateIdentifier ? '#' : '';
|
||||
const name = node.key.type === utils_1.AST_NODE_TYPES.Literal
|
||||
? (0, util_1.getStaticStringValue)(node.key)
|
||||
: node.key.name || '';
|
||||
return !exceptMethods.has(hashIfNeeded + (name ?? ''));
|
||||
}
|
||||
/**
|
||||
* Checks if we are leaving a function that is a method, and reports if 'this' has not been used.
|
||||
* Static methods and the constructor are exempt.
|
||||
* Then pops the context off the stack.
|
||||
*/
|
||||
function exitFunction(node) {
|
||||
const stackContext = popContext();
|
||||
if (stackContext?.member == null ||
|
||||
stackContext.usesThis ||
|
||||
(ignoreOverrideMethods && stackContext.member.override) ||
|
||||
(ignoreClassesThatImplementAnInterface === true &&
|
||||
stackContext.class.implements.length > 0) ||
|
||||
(ignoreClassesThatImplementAnInterface === 'public-fields' &&
|
||||
stackContext.class.implements.length > 0 &&
|
||||
isPublicField(stackContext.member.accessibility))) {
|
||||
return;
|
||||
}
|
||||
if (isIncludedInstanceMethod(stackContext.member)) {
|
||||
context.report({
|
||||
node,
|
||||
loc: (0, util_1.getFunctionHeadLoc)(node, context.sourceCode),
|
||||
messageId: 'missingThis',
|
||||
data: {
|
||||
name: (0, util_1.getFunctionNameWithKind)(node),
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
return {
|
||||
// function declarations have their own `this` context
|
||||
FunctionDeclaration() {
|
||||
pushContext();
|
||||
},
|
||||
'FunctionDeclaration:exit'() {
|
||||
popContext();
|
||||
},
|
||||
FunctionExpression(node) {
|
||||
enterFunction(node);
|
||||
},
|
||||
'FunctionExpression:exit'(node) {
|
||||
exitFunction(node);
|
||||
},
|
||||
...(enforceForClassFields
|
||||
? {
|
||||
'PropertyDefinition > ArrowFunctionExpression.value'(node) {
|
||||
enterFunction(node);
|
||||
},
|
||||
'PropertyDefinition > ArrowFunctionExpression.value:exit'(node) {
|
||||
exitFunction(node);
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
/*
|
||||
* Class field value are implicit functions.
|
||||
*/
|
||||
'PropertyDefinition > *.key:exit'() {
|
||||
pushContext();
|
||||
},
|
||||
'PropertyDefinition:exit'() {
|
||||
popContext();
|
||||
},
|
||||
/*
|
||||
* Class static blocks are implicit functions. They aren't required to use `this`,
|
||||
* but we have to push context so that it captures any use of `this` in the static block
|
||||
* separately from enclosing contexts, because static blocks have their own `this` and it
|
||||
* shouldn't count as used `this` in enclosing contexts.
|
||||
*/
|
||||
StaticBlock() {
|
||||
pushContext();
|
||||
},
|
||||
'StaticBlock:exit'() {
|
||||
popContext();
|
||||
},
|
||||
'ThisExpression, Super'() {
|
||||
if (stack) {
|
||||
stack.usesThis = true;
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=class-methods-use-this.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-methods-use-this.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-methods-use-this.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"class-methods-use-this.js","sourceRoot":"","sources":["../../src/rules/class-methods-use-this.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAKiB;AAYjB,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,2CAA2C;YACxD,eAAe,EAAE,IAAI;YACrB,oBAAoB,EAAE,KAAK;SAC5B;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,aAAa,EAAE;wBACb,IAAI,EAAE,OAAO;wBACb,WAAW,EACT,4DAA4D;wBAC9D,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;yBACf;qBACF;oBACD,qBAAqB,EAAE;wBACrB,IAAI,EAAE,SAAS;wBACf,WAAW,EACT,4EAA4E;wBAC9E,OAAO,EAAE,IAAI;qBACd;oBACD,qBAAqB,EAAE;wBACrB,IAAI,EAAE,SAAS;wBACf,WAAW,EAAE,oDAAoD;qBAClE;oBACD,qCAAqC,EAAE;wBACrC,KAAK,EAAE;4BACL;gCACE,IAAI,EAAE,SAAS;gCACf,WAAW,EAAE,gDAAgD;6BAC9D;4BACD;gCACE,IAAI,EAAE,QAAQ;gCACd,IAAI,EAAE,CAAC,eAAe,CAAC;gCACvB,WAAW,EACT,sEAAsE;6BACzE;yBACF;wBACD,WAAW,EACT,2DAA2D;qBAC9D;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,+CAA+C;SAC7D;KACF;IACD,cAAc,EAAE;QACd;YACE,qBAAqB,EAAE,IAAI;YAC3B,aAAa,EAAE,EA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W,EAAE,CAAC;YAChB,CAAC;YACD,kBAAkB;gBAChB,UAAU,EAAE,CAAC;YACf,CAAC;YAED,uBAAuB;gBACrB,IAAI,KAAK,EAAE,CAAC;oBACV,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;gBACxB,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
108
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js
generated
vendored
Normal file
108
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'consistent-generic-constructors',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce specifying generic type arguments on type annotation or constructor name of a constructor call',
|
||||
recommended: 'stylistic',
|
||||
},
|
||||
messages: {
|
||||
preferTypeAnnotation: 'The generic type arguments should be specified as part of the type annotation.',
|
||||
preferConstructor: 'The generic type arguments should be specified as part of the constructor type arguments.',
|
||||
},
|
||||
fixable: 'code',
|
||||
schema: [
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['type-annotation', 'constructor'],
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: ['constructor'],
|
||||
create(context, [mode]) {
|
||||
return {
|
||||
'VariableDeclarator,PropertyDefinition,:matches(FunctionDeclaration,FunctionExpression) > AssignmentPattern'(node) {
|
||||
function getLHSRHS() {
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.VariableDeclarator:
|
||||
return [node.id, node.init];
|
||||
case utils_1.AST_NODE_TYPES.PropertyDefinition:
|
||||
return [node, node.value];
|
||||
case utils_1.AST_NODE_TYPES.AssignmentPattern:
|
||||
return [node.left, node.right];
|
||||
default:
|
||||
throw new Error(`Unhandled node type: ${node.type}`);
|
||||
}
|
||||
}
|
||||
const [lhsName, rhs] = getLHSRHS();
|
||||
const lhs = lhsName.typeAnnotation?.typeAnnotation;
|
||||
if (!rhs ||
|
||||
rhs.type !== utils_1.AST_NODE_TYPES.NewExpression ||
|
||||
rhs.callee.type !== utils_1.AST_NODE_TYPES.Identifier) {
|
||||
return;
|
||||
}
|
||||
if (lhs &&
|
||||
(lhs.type !== utils_1.AST_NODE_TYPES.TSTypeReference ||
|
||||
lhs.typeName.type !== utils_1.AST_NODE_TYPES.Identifier ||
|
||||
lhs.typeName.name !== rhs.callee.name)) {
|
||||
return;
|
||||
}
|
||||
if (mode === 'type-annotation') {
|
||||
if (!lhs && rhs.typeArguments) {
|
||||
const { typeArguments, callee } = rhs;
|
||||
const typeAnnotation = context.sourceCode.getText(callee) +
|
||||
context.sourceCode.getText(typeArguments);
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'preferTypeAnnotation',
|
||||
fix(fixer) {
|
||||
function getIDToAttachAnnotation() {
|
||||
if (node.type !== utils_1.AST_NODE_TYPES.PropertyDefinition) {
|
||||
return lhsName;
|
||||
}
|
||||
if (!node.computed) {
|
||||
return node.key;
|
||||
}
|
||||
// If the property's computed, we have to attach the
|
||||
// annotation after the square bracket, not the enclosed expression
|
||||
return (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(node.key), util_1.NullThrowsReasons.MissingToken(']', 'key'));
|
||||
}
|
||||
return [
|
||||
fixer.remove(typeArguments),
|
||||
fixer.insertTextAfter(getIDToAttachAnnotation(), ': ' + typeAnnotation),
|
||||
];
|
||||
},
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (lhs?.typeArguments && !rhs.typeArguments) {
|
||||
const hasParens = context.sourceCode.getTokenAfter(rhs.callee)?.value === '(';
|
||||
const extraComments = new Set(context.sourceCode.getCommentsInside(lhs.parent));
|
||||
context.sourceCode
|
||||
.getCommentsInside(lhs.typeArguments)
|
||||
.forEach(c => extraComments.delete(c));
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'preferConstructor',
|
||||
*fix(fixer) {
|
||||
yield fixer.remove(lhs.parent);
|
||||
for (const comment of extraComments) {
|
||||
yield fixer.insertTextAfter(rhs.callee, context.sourceCode.getText(comment));
|
||||
}
|
||||
yield fixer.insertTextAfter(rhs.callee, context.sourceCode.getText(lhs.typeArguments));
|
||||
if (!hasParens) {
|
||||
yield fixer.insertTextAfter(rhs.callee, '()');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=consistent-generic-constructors.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"consistent-generic-constructors.js","sourceRoot":"","sources":["../../src/rules/consistent-generic-constructors.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAAoE;AAKpE,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EACT,wGAAwG;YAC1G,WAAW,EAAE,WAAW;SACzB;QACD,QAAQ,EAAE;YACR,oBAAoB,EAClB,gFAAgF;YAClF,iBAAiB,EACf,2FAA2F;SAC9F;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,iBAAiB,EAAE,aAAa,CAAC;aACzC;SACF;KACF;IACD,cAAc,EAAE,CAAC,aAAa,CAAC;IAC/B,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;QACpB,OAAO;YACL,4GAA4G,CAC1G,IAG+B;gBAE/B,SAAS,SAAS;oBAIhB,QAAQ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AAC,EAAE,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;oBACzC,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI;wBACJ,SAAS,EAAE,mBAAmB;wBAC9B,CAAC,GAAG,CAAC,KAAK;4BACR,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;4BAC/B,KAAK,MAAM,OAAO,IAAI,aAAa,EAAE,CAAC;gCACpC,MAAM,KAAK,CAAC,eAAe,CACzB,GAAG,CAAC,MAAM,EACV,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CACpC,CAAC;4BACJ,CAAC;4BACD,MAAM,KAAK,CAAC,eAAe,CACzB,GAAG,CAAC,MAAM,EACV,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAC9C,CAAC;4BACF,IAAI,CAAC,SAAS,EAAE,CAAC;gCACf,MAAM,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;4BAChD,CAAC;wBACH,CAAC;qBACF,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
126
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js
generated
vendored
Normal file
126
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'consistent-indexed-object-style',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Require or disallow the `Record` type',
|
||||
recommended: 'stylistic',
|
||||
},
|
||||
messages: {
|
||||
preferRecord: 'A record is preferred over an index signature.',
|
||||
preferIndexSignature: 'An index signature is preferred over a record.',
|
||||
},
|
||||
fixable: 'code',
|
||||
schema: [
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['record', 'index-signature'],
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: ['record'],
|
||||
create(context, [mode]) {
|
||||
function checkMembers(members, node, parentId, prefix, postfix, safeFix = true) {
|
||||
if (members.length !== 1) {
|
||||
return;
|
||||
}
|
||||
const [member] = members;
|
||||
if (member.type !== utils_1.AST_NODE_TYPES.TSIndexSignature) {
|
||||
return;
|
||||
}
|
||||
const parameter = member.parameters.at(0);
|
||||
if (parameter?.type !== utils_1.AST_NODE_TYPES.Identifier) {
|
||||
return;
|
||||
}
|
||||
const keyType = parameter.typeAnnotation;
|
||||
if (!keyType) {
|
||||
return;
|
||||
}
|
||||
const valueType = member.typeAnnotation;
|
||||
if (!valueType) {
|
||||
return;
|
||||
}
|
||||
if (parentId) {
|
||||
const scope = context.sourceCode.getScope(parentId);
|
||||
const superVar = utils_1.ASTUtils.findVariable(scope, parentId.name);
|
||||
if (superVar) {
|
||||
const isCircular = superVar.references.some(item => item.isTypeReference &&
|
||||
node.range[0] <= item.identifier.range[0] &&
|
||||
node.range[1] >= item.identifier.range[1]);
|
||||
if (isCircular) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'preferRecord',
|
||||
fix: safeFix
|
||||
? (fixer) => {
|
||||
const key = context.sourceCode.getText(keyType.typeAnnotation);
|
||||
const value = context.sourceCode.getText(valueType.typeAnnotation);
|
||||
const record = member.readonly
|
||||
? `Readonly<Record<${key}, ${value}>>`
|
||||
: `Record<${key}, ${value}>`;
|
||||
return fixer.replaceText(node, `${prefix}${record}${postfix}`);
|
||||
}
|
||||
: null,
|
||||
});
|
||||
}
|
||||
return {
|
||||
...(mode === 'index-signature' && {
|
||||
TSTypeReference(node) {
|
||||
const typeName = node.typeName;
|
||||
if (typeName.type !== utils_1.AST_NODE_TYPES.Identifier) {
|
||||
return;
|
||||
}
|
||||
if (typeName.name !== 'Record') {
|
||||
return;
|
||||
}
|
||||
const params = node.typeArguments?.params;
|
||||
if (params?.length !== 2) {
|
||||
return;
|
||||
}
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'preferIndexSignature',
|
||||
fix(fixer) {
|
||||
const key = context.sourceCode.getText(params[0]);
|
||||
const type = context.sourceCode.getText(params[1]);
|
||||
return fixer.replaceText(node, `{ [key: ${key}]: ${type} }`);
|
||||
},
|
||||
});
|
||||
},
|
||||
}),
|
||||
...(mode === 'record' && {
|
||||
TSTypeLiteral(node) {
|
||||
const parent = findParentDeclaration(node);
|
||||
checkMembers(node.members, node, parent?.id, '', '');
|
||||
},
|
||||
TSInterfaceDeclaration(node) {
|
||||
let genericTypes = '';
|
||||
if (node.typeParameters?.params.length) {
|
||||
genericTypes = `<${node.typeParameters.params
|
||||
.map(p => context.sourceCode.getText(p))
|
||||
.join(', ')}>`;
|
||||
}
|
||||
checkMembers(node.body.body, node, node.id, `type ${node.id.name}${genericTypes} = `, ';', !node.extends.length);
|
||||
},
|
||||
}),
|
||||
};
|
||||
},
|
||||
});
|
||||
function findParentDeclaration(node) {
|
||||
if (node.parent && node.parent.type !== utils_1.AST_NODE_TYPES.TSTypeAnnotation) {
|
||||
if (node.parent.type === utils_1.AST_NODE_TYPES.TSTypeAliasDeclaration) {
|
||||
return node.parent;
|
||||
}
|
||||
return findParentDeclaration(node.parent);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
//# sourceMappingURL=consistent-indexed-object-style.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"consistent-indexed-object-style.js","sourceRoot":"","sources":["../../src/rules/consistent-indexed-object-style.ts"],"names":[],"mappings":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B,IAAI,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;wBACvC,YAAY,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM;6BAC1C,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;6BACvC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;oBACnB,CAAC;oBAED,YAAY,CACV,IAAI,CAAC,IAAI,CAAC,IAAI,EACd,IAAI,EACJ,IAAI,CAAC,EAAE,EACP,QAAQ,IAAI,CAAC,EAAE,CAAC,IAAI,GAAG,YAAY,KAAK,EACxC,GAAG,EACH,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CACrB,CAAC;gBACJ,CAAC;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEH,SAAS,qBAAqB,CAC5B,IAAmB;IAEnB,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,gBAAgB,EAAE,CAAC;QACxE,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,sBAAsB,EAAE,CAAC;YAC/D,OAAO,IAAI,CAAC,MAAM,CAAC;QACrB,CAAC;QACD,OAAO,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
||||
124
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-return.js
generated
vendored
Normal file
124
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-return.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../util");
|
||||
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
|
||||
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('consistent-return');
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'consistent-return',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Require `return` statements to either always or never specify values',
|
||||
extendsBaseRule: true,
|
||||
requiresTypeChecking: true,
|
||||
},
|
||||
hasSuggestions: baseRule.meta.hasSuggestions,
|
||||
schema: baseRule.meta.schema,
|
||||
messages: baseRule.meta.messages,
|
||||
},
|
||||
defaultOptions: [{ treatUndefinedAsUnspecified: false }],
|
||||
create(context, [options]) {
|
||||
const services = (0, util_1.getParserServices)(context);
|
||||
const checker = services.program.getTypeChecker();
|
||||
const rules = baseRule.create(context);
|
||||
const functions = [];
|
||||
const treatUndefinedAsUnspecified = options?.treatUndefinedAsUnspecified === true;
|
||||
function enterFunction(node) {
|
||||
functions.push(node);
|
||||
}
|
||||
function exitFunction() {
|
||||
functions.pop();
|
||||
}
|
||||
function getCurrentFunction() {
|
||||
return functions[functions.length - 1] ?? null;
|
||||
}
|
||||
function isPromiseVoid(node, type) {
|
||||
if (tsutils.isThenableType(checker, node, type) &&
|
||||
tsutils.isTypeReference(type)) {
|
||||
const awaitedType = type.typeArguments?.[0];
|
||||
if (awaitedType) {
|
||||
if ((0, util_1.isTypeFlagSet)(awaitedType, ts.TypeFlags.Void)) {
|
||||
return true;
|
||||
}
|
||||
return isPromiseVoid(node, awaitedType);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isReturnVoidOrThenableVoid(node) {
|
||||
const functionType = services.getTypeAtLocation(node);
|
||||
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
|
||||
const callSignatures = functionType.getCallSignatures();
|
||||
return callSignatures.some(signature => {
|
||||
const returnType = signature.getReturnType();
|
||||
if (node.async) {
|
||||
return isPromiseVoid(tsNode, returnType);
|
||||
}
|
||||
return (0, util_1.isTypeFlagSet)(returnType, ts.TypeFlags.Void);
|
||||
});
|
||||
}
|
||||
return {
|
||||
...rules,
|
||||
FunctionDeclaration: enterFunction,
|
||||
'FunctionDeclaration:exit'(node) {
|
||||
exitFunction();
|
||||
rules['FunctionDeclaration:exit'](node);
|
||||
},
|
||||
FunctionExpression: enterFunction,
|
||||
'FunctionExpression:exit'(node) {
|
||||
exitFunction();
|
||||
rules['FunctionExpression:exit'](node);
|
||||
},
|
||||
ArrowFunctionExpression: enterFunction,
|
||||
'ArrowFunctionExpression:exit'(node) {
|
||||
exitFunction();
|
||||
rules['ArrowFunctionExpression:exit'](node);
|
||||
},
|
||||
ReturnStatement(node) {
|
||||
const functionNode = getCurrentFunction();
|
||||
if (!node.argument &&
|
||||
functionNode &&
|
||||
isReturnVoidOrThenableVoid(functionNode)) {
|
||||
return;
|
||||
}
|
||||
if (treatUndefinedAsUnspecified && node.argument) {
|
||||
const returnValueType = services.getTypeAtLocation(node.argument);
|
||||
if (returnValueType.flags === ts.TypeFlags.Undefined) {
|
||||
rules.ReturnStatement({
|
||||
...node,
|
||||
argument: null,
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
rules.ReturnStatement(node);
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=consistent-return.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-return.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-return.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"consistent-return.js","sourceRoot":"","sources":["../../src/rules/consistent-return.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,sDAAwC;AACxC,+CAAiC;AAMjC,kCAAuE;AACvE,iEAA8D;AAE9D,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC,mBAAmB,CAAC,CAAC;AAUxD,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EACT,sEAAsE;YACxE,eAAe,EAAE,IAAI;YACrB,oBAAoB,EAAE,IAAI;SAC3B;QACD,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,cAAc;QAC5C,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;QAC5B,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ;KACjC;IACD,cAAc,EAAE,CAAC,EAAE,2BAA2B,EAAE,KAAK,EAAE,CAAC;IACxD,MAAM,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC;QACvB,MAAM,QAAQ,GAAG,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,OA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H,OAAO;oBACT,CAAC;gBACH,CAAC;gBAED,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAC9B,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
209
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-assertions.js
generated
vendored
Normal file
209
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-assertions.js
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../util");
|
||||
const getWrappedCode_1 = require("../util/getWrappedCode");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'consistent-type-assertions',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
fixable: 'code',
|
||||
hasSuggestions: true,
|
||||
docs: {
|
||||
description: 'Enforce consistent usage of type assertions',
|
||||
recommended: 'stylistic',
|
||||
},
|
||||
messages: {
|
||||
as: "Use 'as {{cast}}' instead of '<{{cast}}>'.",
|
||||
'angle-bracket': "Use '<{{cast}}>' instead of 'as {{cast}}'.",
|
||||
never: 'Do not use any type assertions.',
|
||||
unexpectedObjectTypeAssertion: 'Always prefer const x: T = { ... }.',
|
||||
replaceObjectTypeAssertionWithAnnotation: 'Use const x: {{cast}} = { ... } instead.',
|
||||
replaceObjectTypeAssertionWithSatisfies: 'Use const x = { ... } satisfies {{cast}} instead.',
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
oneOf: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
assertionStyle: {
|
||||
type: 'string',
|
||||
enum: ['never'],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
required: ['assertionStyle'],
|
||||
},
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
assertionStyle: {
|
||||
type: 'string',
|
||||
enum: ['as', 'angle-bracket'],
|
||||
},
|
||||
objectLiteralTypeAssertions: {
|
||||
type: 'string',
|
||||
enum: ['allow', 'allow-as-parameter', 'never'],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
required: ['assertionStyle'],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
assertionStyle: 'as',
|
||||
objectLiteralTypeAssertions: 'allow',
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
const parserServices = (0, util_1.getParserServices)(context, true);
|
||||
function isConst(node) {
|
||||
if (node.type !== utils_1.AST_NODE_TYPES.TSTypeReference) {
|
||||
return false;
|
||||
}
|
||||
return (node.typeName.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
node.typeName.name === 'const');
|
||||
}
|
||||
function reportIncorrectAssertionType(node) {
|
||||
const messageId = options.assertionStyle;
|
||||
// If this node is `as const`, then don't report an error.
|
||||
if (isConst(node.typeAnnotation) && messageId === 'never') {
|
||||
return;
|
||||
}
|
||||
context.report({
|
||||
node,
|
||||
messageId,
|
||||
data: messageId !== 'never'
|
||||
? { cast: context.sourceCode.getText(node.typeAnnotation) }
|
||||
: {},
|
||||
fix: messageId === 'as'
|
||||
? (fixer) => {
|
||||
const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node);
|
||||
const expressionCode = context.sourceCode.getText(node.expression);
|
||||
const typeAnnotationCode = context.sourceCode.getText(node.typeAnnotation);
|
||||
const asPrecedence = (0, util_1.getOperatorPrecedence)(ts.SyntaxKind.AsExpression, ts.SyntaxKind.Unknown);
|
||||
const parentPrecedence = (0, util_1.getOperatorPrecedence)(tsNode.parent.kind, ts.isBinaryExpression(tsNode.parent)
|
||||
? tsNode.parent.operatorToken.kind
|
||||
: ts.SyntaxKind.Unknown, ts.isNewExpression(tsNode.parent)
|
||||
? tsNode.parent.arguments != null &&
|
||||
tsNode.parent.arguments.length > 0
|
||||
: undefined);
|
||||
const expressionPrecedence = (0, util_1.getOperatorPrecedenceForNode)(node.expression);
|
||||
const expressionCodeWrapped = (0, getWrappedCode_1.getWrappedCode)(expressionCode, expressionPrecedence, asPrecedence);
|
||||
const text = `${expressionCodeWrapped} as ${typeAnnotationCode}`;
|
||||
return fixer.replaceText(node, (0, util_1.isParenthesized)(node, context.sourceCode)
|
||||
? text
|
||||
: (0, getWrappedCode_1.getWrappedCode)(text, asPrecedence, parentPrecedence));
|
||||
}
|
||||
: undefined,
|
||||
});
|
||||
}
|
||||
function checkType(node) {
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.TSAnyKeyword:
|
||||
case utils_1.AST_NODE_TYPES.TSUnknownKeyword:
|
||||
return false;
|
||||
case utils_1.AST_NODE_TYPES.TSTypeReference:
|
||||
return (
|
||||
// Ignore `as const` and `<const>`
|
||||
!isConst(node) ||
|
||||
// Allow qualified names which have dots between identifiers, `Foo.Bar`
|
||||
node.typeName.type === utils_1.AST_NODE_TYPES.TSQualifiedName);
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function checkExpression(node) {
|
||||
if (options.assertionStyle === 'never' ||
|
||||
options.objectLiteralTypeAssertions === 'allow' ||
|
||||
node.expression.type !== utils_1.AST_NODE_TYPES.ObjectExpression) {
|
||||
return;
|
||||
}
|
||||
if (options.objectLiteralTypeAssertions === 'allow-as-parameter' &&
|
||||
(node.parent.type === utils_1.AST_NODE_TYPES.NewExpression ||
|
||||
node.parent.type === utils_1.AST_NODE_TYPES.CallExpression ||
|
||||
node.parent.type === utils_1.AST_NODE_TYPES.ThrowStatement ||
|
||||
node.parent.type === utils_1.AST_NODE_TYPES.AssignmentPattern ||
|
||||
node.parent.type === utils_1.AST_NODE_TYPES.JSXExpressionContainer ||
|
||||
(node.parent.type === utils_1.AST_NODE_TYPES.TemplateLiteral &&
|
||||
node.parent.parent.type ===
|
||||
utils_1.AST_NODE_TYPES.TaggedTemplateExpression))) {
|
||||
return;
|
||||
}
|
||||
if (checkType(node.typeAnnotation)) {
|
||||
const suggest = [];
|
||||
if (node.parent.type === utils_1.AST_NODE_TYPES.VariableDeclarator &&
|
||||
!node.parent.id.typeAnnotation) {
|
||||
const { parent } = node;
|
||||
suggest.push({
|
||||
messageId: 'replaceObjectTypeAssertionWithAnnotation',
|
||||
data: { cast: context.sourceCode.getText(node.typeAnnotation) },
|
||||
fix: fixer => [
|
||||
fixer.insertTextAfter(parent.id, `: ${context.sourceCode.getText(node.typeAnnotation)}`),
|
||||
fixer.replaceText(node, (0, util_1.getTextWithParentheses)(context.sourceCode, node.expression)),
|
||||
],
|
||||
});
|
||||
}
|
||||
suggest.push({
|
||||
messageId: 'replaceObjectTypeAssertionWithSatisfies',
|
||||
data: { cast: context.sourceCode.getText(node.typeAnnotation) },
|
||||
fix: fixer => [
|
||||
fixer.replaceText(node, (0, util_1.getTextWithParentheses)(context.sourceCode, node.expression)),
|
||||
fixer.insertTextAfter(node, ` satisfies ${context.sourceCode.getText(node.typeAnnotation)}`),
|
||||
],
|
||||
});
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'unexpectedObjectTypeAssertion',
|
||||
suggest,
|
||||
});
|
||||
}
|
||||
}
|
||||
return {
|
||||
TSTypeAssertion(node) {
|
||||
if (options.assertionStyle !== 'angle-bracket') {
|
||||
reportIncorrectAssertionType(node);
|
||||
return;
|
||||
}
|
||||
checkExpression(node);
|
||||
},
|
||||
TSAsExpression(node) {
|
||||
if (options.assertionStyle !== 'as') {
|
||||
reportIncorrectAssertionType(node);
|
||||
return;
|
||||
}
|
||||
checkExpression(node);
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=consistent-type-assertions.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-assertions.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-assertions.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
98
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-definitions.js
generated
vendored
Normal file
98
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-definitions.js
generated
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'consistent-type-definitions',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce type definitions to consistently use either `interface` or `type`',
|
||||
recommended: 'stylistic',
|
||||
},
|
||||
messages: {
|
||||
interfaceOverType: 'Use an `interface` instead of a `type`.',
|
||||
typeOverInterface: 'Use a `type` instead of an `interface`.',
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['interface', 'type'],
|
||||
},
|
||||
],
|
||||
fixable: 'code',
|
||||
},
|
||||
defaultOptions: ['interface'],
|
||||
create(context, [option]) {
|
||||
/**
|
||||
* Iterates from the highest parent to the currently traversed node
|
||||
* to determine whether any node in tree is globally declared module declaration
|
||||
*/
|
||||
function isCurrentlyTraversedNodeWithinModuleDeclaration(node) {
|
||||
return context.sourceCode
|
||||
.getAncestors(node)
|
||||
.some(node => node.type === utils_1.AST_NODE_TYPES.TSModuleDeclaration &&
|
||||
node.declare &&
|
||||
node.kind === 'global');
|
||||
}
|
||||
return {
|
||||
...(option === 'interface' && {
|
||||
"TSTypeAliasDeclaration[typeAnnotation.type='TSTypeLiteral']"(node) {
|
||||
context.report({
|
||||
node: node.id,
|
||||
messageId: 'interfaceOverType',
|
||||
fix(fixer) {
|
||||
const typeNode = node.typeParameters ?? node.id;
|
||||
const fixes = [];
|
||||
const firstToken = context.sourceCode.getTokenBefore(node.id);
|
||||
if (firstToken) {
|
||||
fixes.push(fixer.replaceText(firstToken, 'interface'));
|
||||
fixes.push(fixer.replaceTextRange([typeNode.range[1], node.typeAnnotation.range[0]], ' '));
|
||||
}
|
||||
const afterToken = context.sourceCode.getTokenAfter(node.typeAnnotation);
|
||||
if (afterToken &&
|
||||
afterToken.type === utils_1.AST_TOKEN_TYPES.Punctuator &&
|
||||
afterToken.value === ';') {
|
||||
fixes.push(fixer.remove(afterToken));
|
||||
}
|
||||
return fixes;
|
||||
},
|
||||
});
|
||||
},
|
||||
}),
|
||||
...(option === 'type' && {
|
||||
TSInterfaceDeclaration(node) {
|
||||
const fix = isCurrentlyTraversedNodeWithinModuleDeclaration(node)
|
||||
? null
|
||||
: (fixer) => {
|
||||
const typeNode = node.typeParameters ?? node.id;
|
||||
const fixes = [];
|
||||
const firstToken = context.sourceCode.getTokenBefore(node.id);
|
||||
if (firstToken) {
|
||||
fixes.push(fixer.replaceText(firstToken, 'type'));
|
||||
fixes.push(fixer.replaceTextRange([typeNode.range[1], node.body.range[0]], ' = '));
|
||||
}
|
||||
node.extends.forEach(heritage => {
|
||||
const typeIdentifier = context.sourceCode.getText(heritage);
|
||||
fixes.push(fixer.insertTextAfter(node.body, ` & ${typeIdentifier}`));
|
||||
});
|
||||
if (node.parent.type === utils_1.AST_NODE_TYPES.ExportDefaultDeclaration) {
|
||||
fixes.push(fixer.removeRange([node.parent.range[0], node.range[0]]), fixer.insertTextAfter(node.body, `\nexport default ${node.id.name}`));
|
||||
}
|
||||
return fixes;
|
||||
};
|
||||
context.report({
|
||||
node: node.id,
|
||||
messageId: 'typeOverInterface',
|
||||
/**
|
||||
* remove automatically fix when the interface is within a declare global
|
||||
* @see {@link https://github.com/typescript-eslint/typescript-eslint/issues/2707}
|
||||
*/
|
||||
fix,
|
||||
});
|
||||
},
|
||||
}),
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=consistent-type-definitions.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-definitions.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-definitions.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"consistent-type-definitions.js","sourceRoot":"","sources":["../../src/rules/consistent-type-definitions.ts"],"names":[],"mappings":";;AACA,oDAA2E;AAE3E,kCAAqC;AAErC,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,6BAA6B;IACnC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EACT,2EAA2E;YAC7E,WAAW,EAAE,WAAW;SACzB;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,yCAAyC;YAC5D,iBAAiB,EAAE,yCAAyC;SAC7D;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;aAC5B;SACF;QACD,OAAO,EAAE,MAAM;KAChB;IACD,cAAc,EAAE,CAAC,WAAW,CAAC;IAC7B,MAAM,CAAC,OAAO,EAAE,CAAC,MAAM,CA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B,EAC5D,CAAC;gCACD,KAAK,CAAC,IAAI,CACR,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EACxD,KAAK,CAAC,eAAe,CACnB,IAAI,CAAC,IAAI,EACT,oBAAoB,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CACnC,CACF,CAAC;4BACJ,CAAC;4BAED,OAAO,KAAK,CAAC;wBACf,CAAC,CAAC;oBACN,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI,EAAE,IAAI,CAAC,EAAE;wBACb,SAAS,EAAE,mBAAmB;wBAC9B;;;2BAGG;wBACH,GAAG;qBACJ,CAAC,CAAC;gBACL,CAAC;aACF,CAAC;SACH,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
243
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-exports.js
generated
vendored
Normal file
243
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-exports.js
generated
vendored
Normal file
@@ -0,0 +1,243 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const typescript_1 = require("typescript");
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'consistent-type-exports',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce consistent usage of type exports',
|
||||
requiresTypeChecking: true,
|
||||
},
|
||||
messages: {
|
||||
typeOverValue: 'All exports in the declaration are only used as types. Use `export type`.',
|
||||
singleExportIsType: 'Type export {{exportNames}} is not a value and should be exported using `export type`.',
|
||||
multipleExportsAreTypes: 'Type exports {{exportNames}} are not values and should be exported using `export type`.',
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
fixMixedExportsWithInlineTypeSpecifier: {
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
fixable: 'code',
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
fixMixedExportsWithInlineTypeSpecifier: false,
|
||||
},
|
||||
],
|
||||
create(context, [{ fixMixedExportsWithInlineTypeSpecifier }]) {
|
||||
const sourceExportsMap = {};
|
||||
const services = (0, util_1.getParserServices)(context);
|
||||
/**
|
||||
* Helper for identifying if an export specifier resolves to a
|
||||
* JavaScript value or a TypeScript type.
|
||||
*
|
||||
* @returns True/false if is a type or not, or undefined if the specifier
|
||||
* can't be resolved.
|
||||
*/
|
||||
function isSpecifierTypeBased(specifier) {
|
||||
const checker = services.program.getTypeChecker();
|
||||
const symbol = services.getSymbolAtLocation(specifier.exported);
|
||||
if (!symbol) {
|
||||
return undefined;
|
||||
}
|
||||
const aliasedSymbol = checker.getAliasedSymbol(symbol);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
|
||||
if (aliasedSymbol.escapedName === 'unknown') {
|
||||
return undefined;
|
||||
}
|
||||
return !(aliasedSymbol.flags & typescript_1.SymbolFlags.Value);
|
||||
}
|
||||
return {
|
||||
ExportNamedDeclaration(node) {
|
||||
// Coerce the source into a string for use as a lookup entry.
|
||||
const source = getSourceFromExport(node) ?? 'undefined';
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
const sourceExports = (sourceExportsMap[source] ||= {
|
||||
source,
|
||||
reportValueExports: [],
|
||||
typeOnlyNamedExport: null,
|
||||
valueOnlyNamedExport: null,
|
||||
});
|
||||
// Cache the first encountered exports for the package. We will need to come
|
||||
// back to these later when fixing the problems.
|
||||
if (node.exportKind === 'type') {
|
||||
if (sourceExports.typeOnlyNamedExport == null) {
|
||||
// The export is a type export
|
||||
sourceExports.typeOnlyNamedExport = node;
|
||||
}
|
||||
}
|
||||
else if (sourceExports.valueOnlyNamedExport == null) {
|
||||
// The export is a value export
|
||||
sourceExports.valueOnlyNamedExport = node;
|
||||
}
|
||||
// Next for the current export, we will separate type/value specifiers.
|
||||
const typeBasedSpecifiers = [];
|
||||
const inlineTypeSpecifiers = [];
|
||||
const valueSpecifiers = [];
|
||||
// Note: it is valid to export values as types. We will avoid reporting errors
|
||||
// when this is encountered.
|
||||
if (node.exportKind !== 'type') {
|
||||
for (const specifier of node.specifiers) {
|
||||
if (specifier.exportKind === 'type') {
|
||||
inlineTypeSpecifiers.push(specifier);
|
||||
continue;
|
||||
}
|
||||
const isTypeBased = isSpecifierTypeBased(specifier);
|
||||
if (isTypeBased === true) {
|
||||
typeBasedSpecifiers.push(specifier);
|
||||
}
|
||||
else if (isTypeBased === false) {
|
||||
// When isTypeBased is undefined, we should avoid reporting them.
|
||||
valueSpecifiers.push(specifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((node.exportKind === 'value' && typeBasedSpecifiers.length) ||
|
||||
(node.exportKind === 'type' && valueSpecifiers.length)) {
|
||||
sourceExports.reportValueExports.push({
|
||||
node,
|
||||
typeBasedSpecifiers,
|
||||
valueSpecifiers,
|
||||
inlineTypeSpecifiers,
|
||||
});
|
||||
}
|
||||
},
|
||||
'Program:exit'() {
|
||||
for (const sourceExports of Object.values(sourceExportsMap)) {
|
||||
// If this export has no issues, move on.
|
||||
if (sourceExports.reportValueExports.length === 0) {
|
||||
continue;
|
||||
}
|
||||
for (const report of sourceExports.reportValueExports) {
|
||||
if (report.valueSpecifiers.length === 0) {
|
||||
// Export is all type-only with no type specifiers; convert the entire export to `export type`.
|
||||
context.report({
|
||||
node: report.node,
|
||||
messageId: 'typeOverValue',
|
||||
*fix(fixer) {
|
||||
yield* fixExportInsertType(fixer, context.sourceCode, report.node);
|
||||
},
|
||||
});
|
||||
continue;
|
||||
}
|
||||
// We have both type and value violations.
|
||||
const allExportNames = report.typeBasedSpecifiers.map(specifier => specifier.local.name);
|
||||
if (allExportNames.length === 1) {
|
||||
const exportNames = allExportNames[0];
|
||||
context.report({
|
||||
node: report.node,
|
||||
messageId: 'singleExportIsType',
|
||||
data: { exportNames },
|
||||
*fix(fixer) {
|
||||
if (fixMixedExportsWithInlineTypeSpecifier) {
|
||||
yield* fixAddTypeSpecifierToNamedExports(fixer, report);
|
||||
}
|
||||
else {
|
||||
yield* fixSeparateNamedExports(fixer, context.sourceCode, report);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
else {
|
||||
const exportNames = (0, util_1.formatWordList)(allExportNames);
|
||||
context.report({
|
||||
node: report.node,
|
||||
messageId: 'multipleExportsAreTypes',
|
||||
data: { exportNames },
|
||||
*fix(fixer) {
|
||||
if (fixMixedExportsWithInlineTypeSpecifier) {
|
||||
yield* fixAddTypeSpecifierToNamedExports(fixer, report);
|
||||
}
|
||||
else {
|
||||
yield* fixSeparateNamedExports(fixer, context.sourceCode, report);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
/**
|
||||
* Inserts "type" into an export.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* export type { Foo } from 'foo';
|
||||
* ^^^^
|
||||
*/
|
||||
function* fixExportInsertType(fixer, sourceCode, node) {
|
||||
const exportToken = (0, util_1.nullThrows)(sourceCode.getFirstToken(node), util_1.NullThrowsReasons.MissingToken('export', node.type));
|
||||
yield fixer.insertTextAfter(exportToken, ' type');
|
||||
for (const specifier of node.specifiers) {
|
||||
if (specifier.exportKind === 'type') {
|
||||
const kindToken = (0, util_1.nullThrows)(sourceCode.getFirstToken(specifier), util_1.NullThrowsReasons.MissingToken('export', specifier.type));
|
||||
const firstTokenAfter = (0, util_1.nullThrows)(sourceCode.getTokenAfter(kindToken, {
|
||||
includeComments: true,
|
||||
}), 'Missing token following the export kind.');
|
||||
yield fixer.removeRange([kindToken.range[0], firstTokenAfter.range[0]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Separates the exports which mismatch the kind of export the given
|
||||
* node represents. For example, a type export's named specifiers which
|
||||
* represent values will be inserted in a separate `export` statement.
|
||||
*/
|
||||
function* fixSeparateNamedExports(fixer, sourceCode, report) {
|
||||
const { node, typeBasedSpecifiers, inlineTypeSpecifiers, valueSpecifiers } = report;
|
||||
const typeSpecifiers = typeBasedSpecifiers.concat(inlineTypeSpecifiers);
|
||||
const source = getSourceFromExport(node);
|
||||
const specifierNames = typeSpecifiers.map(getSpecifierText).join(', ');
|
||||
const exportToken = (0, util_1.nullThrows)(sourceCode.getFirstToken(node), util_1.NullThrowsReasons.MissingToken('export', node.type));
|
||||
// Filter the bad exports from the current line.
|
||||
const filteredSpecifierNames = valueSpecifiers
|
||||
.map(getSpecifierText)
|
||||
.join(', ');
|
||||
const openToken = (0, util_1.nullThrows)(sourceCode.getFirstToken(node, util_1.isOpeningBraceToken), util_1.NullThrowsReasons.MissingToken('{', node.type));
|
||||
const closeToken = (0, util_1.nullThrows)(sourceCode.getLastToken(node, util_1.isClosingBraceToken), util_1.NullThrowsReasons.MissingToken('}', node.type));
|
||||
// Remove exports from the current line which we're going to re-insert.
|
||||
yield fixer.replaceTextRange([openToken.range[1], closeToken.range[0]], ` ${filteredSpecifierNames} `);
|
||||
// Insert the bad exports into a new export line above.
|
||||
yield fixer.insertTextBefore(exportToken, `export type { ${specifierNames} }${source ? ` from '${source}'` : ''};\n`);
|
||||
}
|
||||
function* fixAddTypeSpecifierToNamedExports(fixer, report) {
|
||||
if (report.node.exportKind === 'type') {
|
||||
return;
|
||||
}
|
||||
for (const specifier of report.typeBasedSpecifiers) {
|
||||
yield fixer.insertTextBefore(specifier, 'type ');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the source of the export, or undefined if the named export has no source.
|
||||
*/
|
||||
function getSourceFromExport(node) {
|
||||
if (node.source?.type === utils_1.AST_NODE_TYPES.Literal &&
|
||||
typeof node.source.value === 'string') {
|
||||
return node.source.value;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/**
|
||||
* Returns the specifier text for the export. If it is aliased, we take care to return
|
||||
* the proper formatting.
|
||||
*/
|
||||
function getSpecifierText(specifier) {
|
||||
return `${specifier.local.name}${specifier.exported.name !== specifier.local.name
|
||||
? ` as ${specifier.exported.name}`
|
||||
: ''}`;
|
||||
}
|
||||
//# sourceMappingURL=consistent-type-exports.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-exports.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-exports.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
606
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-imports.js
generated
vendored
Normal file
606
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-imports.js
generated
vendored
Normal file
@@ -0,0 +1,606 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'consistent-type-imports',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce consistent usage of type imports',
|
||||
},
|
||||
messages: {
|
||||
typeOverValue: 'All imports in the declaration are only used as types. Use `import type`.',
|
||||
someImportsAreOnlyTypes: 'Imports {{typeImports}} are only used as type.',
|
||||
avoidImportType: 'Use an `import` instead of an `import type`.',
|
||||
noImportTypeAnnotations: '`import()` type annotations are forbidden.',
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
disallowTypeAnnotations: {
|
||||
type: 'boolean',
|
||||
},
|
||||
fixStyle: {
|
||||
type: 'string',
|
||||
enum: ['separate-type-imports', 'inline-type-imports'],
|
||||
},
|
||||
prefer: {
|
||||
type: 'string',
|
||||
enum: ['type-imports', 'no-type-imports'],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
fixable: 'code',
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
prefer: 'type-imports',
|
||||
disallowTypeAnnotations: true,
|
||||
fixStyle: 'separate-type-imports',
|
||||
},
|
||||
],
|
||||
create(context, [option]) {
|
||||
const prefer = option.prefer ?? 'type-imports';
|
||||
const disallowTypeAnnotations = option.disallowTypeAnnotations !== false;
|
||||
const selectors = {};
|
||||
if (disallowTypeAnnotations) {
|
||||
selectors.TSImportType = (node) => {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'noImportTypeAnnotations',
|
||||
});
|
||||
};
|
||||
}
|
||||
if (prefer === 'no-type-imports') {
|
||||
return {
|
||||
...selectors,
|
||||
'ImportDeclaration[importKind = "type"]'(node) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'avoidImportType',
|
||||
fix(fixer) {
|
||||
return fixRemoveTypeSpecifierFromImportDeclaration(fixer, node);
|
||||
},
|
||||
});
|
||||
},
|
||||
'ImportSpecifier[importKind = "type"]'(node) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'avoidImportType',
|
||||
fix(fixer) {
|
||||
return fixRemoveTypeSpecifierFromImportSpecifier(fixer, node);
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
// prefer type imports
|
||||
const fixStyle = option.fixStyle ?? 'separate-type-imports';
|
||||
let hasDecoratorMetadata = false;
|
||||
const sourceImportsMap = {};
|
||||
const emitDecoratorMetadata = (0, util_1.getParserServices)(context, true).emitDecoratorMetadata ?? false;
|
||||
const experimentalDecorators = (0, util_1.getParserServices)(context, true).experimentalDecorators ?? false;
|
||||
if (experimentalDecorators && emitDecoratorMetadata) {
|
||||
selectors.Decorator = () => {
|
||||
hasDecoratorMetadata = true;
|
||||
};
|
||||
}
|
||||
return {
|
||||
...selectors,
|
||||
ImportDeclaration(node) {
|
||||
const source = node.source.value;
|
||||
// sourceImports is the object containing all the specifics for a particular import source, type or value
|
||||
sourceImportsMap[source] ??= {
|
||||
source,
|
||||
reportValueImports: [], // if there is a mismatch where type importKind but value specifiers
|
||||
typeOnlyNamedImport: null, // if only type imports
|
||||
valueOnlyNamedImport: null, // if only value imports with named specifiers
|
||||
valueImport: null, // if only value imports
|
||||
};
|
||||
const sourceImports = sourceImportsMap[source];
|
||||
if (node.importKind === 'type') {
|
||||
if (!sourceImports.typeOnlyNamedImport &&
|
||||
node.specifiers.every(specifier => specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier)) {
|
||||
// definitely import type { TypeX }
|
||||
sourceImports.typeOnlyNamedImport = node;
|
||||
}
|
||||
}
|
||||
else if (!sourceImports.valueOnlyNamedImport &&
|
||||
node.specifiers.length &&
|
||||
node.specifiers.every(specifier => specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier)) {
|
||||
sourceImports.valueOnlyNamedImport = node;
|
||||
sourceImports.valueImport = node;
|
||||
}
|
||||
else if (!sourceImports.valueImport &&
|
||||
node.specifiers.some(specifier => specifier.type === utils_1.AST_NODE_TYPES.ImportDefaultSpecifier)) {
|
||||
sourceImports.valueImport = node;
|
||||
}
|
||||
const typeSpecifiers = [];
|
||||
const inlineTypeSpecifiers = [];
|
||||
const valueSpecifiers = [];
|
||||
const unusedSpecifiers = [];
|
||||
for (const specifier of node.specifiers) {
|
||||
if (specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier &&
|
||||
specifier.importKind === 'type') {
|
||||
inlineTypeSpecifiers.push(specifier);
|
||||
continue;
|
||||
}
|
||||
const [variable] = context.sourceCode.getDeclaredVariables(specifier);
|
||||
if (variable.references.length === 0) {
|
||||
unusedSpecifiers.push(specifier);
|
||||
}
|
||||
else {
|
||||
const onlyHasTypeReferences = variable.references.every(ref => {
|
||||
/**
|
||||
* keep origin import kind when export
|
||||
* export { Type }
|
||||
* export default Type;
|
||||
* export = Type;
|
||||
*/
|
||||
if (ref.identifier.parent.type === utils_1.AST_NODE_TYPES.ExportSpecifier ||
|
||||
ref.identifier.parent.type ===
|
||||
utils_1.AST_NODE_TYPES.ExportDefaultDeclaration ||
|
||||
ref.identifier.parent.type === utils_1.AST_NODE_TYPES.TSExportAssignment) {
|
||||
if (ref.isValueReference && ref.isTypeReference) {
|
||||
return node.importKind === 'type';
|
||||
}
|
||||
}
|
||||
if (ref.isValueReference) {
|
||||
let parent = ref.identifier.parent;
|
||||
let child = ref.identifier;
|
||||
while (parent) {
|
||||
switch (parent.type) {
|
||||
// CASE 1:
|
||||
// `type T = typeof foo` will create a value reference because "foo" must be a value type
|
||||
// however this value reference is safe to use with type-only imports
|
||||
case utils_1.AST_NODE_TYPES.TSTypeQuery:
|
||||
return true;
|
||||
case utils_1.AST_NODE_TYPES.TSQualifiedName:
|
||||
// TSTypeQuery must have a TSESTree.EntityName as its child, so we can filter here and break early
|
||||
if (parent.left !== child) {
|
||||
return false;
|
||||
}
|
||||
child = parent;
|
||||
parent = parent.parent;
|
||||
continue;
|
||||
// END CASE 1
|
||||
//////////////
|
||||
// CASE 2:
|
||||
// `type T = { [foo]: string }` will create a value reference because "foo" must be a value type
|
||||
// however this value reference is safe to use with type-only imports.
|
||||
// Also this is represented as a non-type AST - hence it uses MemberExpression
|
||||
case utils_1.AST_NODE_TYPES.TSPropertySignature:
|
||||
return parent.key === child;
|
||||
case utils_1.AST_NODE_TYPES.MemberExpression:
|
||||
if (parent.object !== child) {
|
||||
return false;
|
||||
}
|
||||
child = parent;
|
||||
parent = parent.parent;
|
||||
continue;
|
||||
// END CASE 2
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ref.isTypeReference;
|
||||
});
|
||||
if (onlyHasTypeReferences) {
|
||||
typeSpecifiers.push(specifier);
|
||||
}
|
||||
else {
|
||||
valueSpecifiers.push(specifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (node.importKind === 'value' && typeSpecifiers.length) {
|
||||
sourceImports.reportValueImports.push({
|
||||
node,
|
||||
typeSpecifiers,
|
||||
valueSpecifiers,
|
||||
unusedSpecifiers,
|
||||
inlineTypeSpecifiers,
|
||||
});
|
||||
}
|
||||
},
|
||||
'Program:exit'() {
|
||||
if (hasDecoratorMetadata) {
|
||||
// Experimental decorator metadata is bowl of poop that cannot be
|
||||
// supported based on pure syntactic analysis.
|
||||
//
|
||||
// So we can do one of two things:
|
||||
// 1) add type-information to the rule in a breaking change and
|
||||
// prevent users from using it so that we can fully support this
|
||||
// case.
|
||||
// 2) make the rule ignore all imports that are used in a file that
|
||||
// might have decorator metadata.
|
||||
//
|
||||
// (1) is has huge impact and prevents the rule from being used by 99%
|
||||
// of users Frankly - it's a straight-up bad option. So instead we
|
||||
// choose with option (2) and just avoid reporting on any imports in a
|
||||
// file with both emitDecoratorMetadata AND decorators
|
||||
//
|
||||
// For more context see the discussion in this issue and its linked
|
||||
// issues:
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/5468
|
||||
//
|
||||
//
|
||||
// NOTE - in TS 5.0 `experimentalDecorators` became the legacy option,
|
||||
// replaced with un-flagged, stable decorators and thus the type-aware
|
||||
// emitDecoratorMetadata implementation also became legacy. in TS 5.2
|
||||
// support for the new, stable decorator metadata proposal was added -
|
||||
// however this proposal does not include type information
|
||||
//
|
||||
//
|
||||
// PHEW. So TL;DR what does all this mean?
|
||||
// - if you use experimentalDecorators:true,
|
||||
// emitDecoratorMetadata:true, and have a decorator in the file -
|
||||
// the rule will do nothing in the file out of an abundance of
|
||||
// caution.
|
||||
// - else the rule will work as normal.
|
||||
return;
|
||||
}
|
||||
for (const sourceImports of Object.values(sourceImportsMap)) {
|
||||
if (sourceImports.reportValueImports.length === 0) {
|
||||
// nothing to fix. value specifiers and type specifiers are correctly written
|
||||
continue;
|
||||
}
|
||||
for (const report of sourceImports.reportValueImports) {
|
||||
if (report.valueSpecifiers.length === 0 &&
|
||||
report.unusedSpecifiers.length === 0 &&
|
||||
report.node.importKind !== 'type') {
|
||||
/**
|
||||
* checks if import has type assertions
|
||||
* @example
|
||||
* ```ts
|
||||
* import * as type from 'mod' assert \{ type: 'json' \};
|
||||
* ```
|
||||
* https://github.com/typescript-eslint/typescript-eslint/issues/7527
|
||||
*/
|
||||
if (report.node.attributes.length === 0) {
|
||||
context.report({
|
||||
node: report.node,
|
||||
messageId: 'typeOverValue',
|
||||
*fix(fixer) {
|
||||
yield* fixToTypeImportDeclaration(fixer, report, sourceImports);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
// we have a mixed type/value import or just value imports, so we need to split them out into multiple imports if separate-type-imports is configured
|
||||
const importNames = report.typeSpecifiers.map(specifier => `"${specifier.local.name}"`);
|
||||
const message = (() => {
|
||||
const typeImports = (0, util_1.formatWordList)(importNames);
|
||||
if (importNames.length === 1) {
|
||||
return {
|
||||
messageId: 'someImportsAreOnlyTypes',
|
||||
data: {
|
||||
typeImports,
|
||||
},
|
||||
};
|
||||
}
|
||||
return {
|
||||
messageId: 'someImportsAreOnlyTypes',
|
||||
data: {
|
||||
typeImports,
|
||||
},
|
||||
};
|
||||
})();
|
||||
context.report({
|
||||
node: report.node,
|
||||
...message,
|
||||
*fix(fixer) {
|
||||
// take all the typeSpecifiers and put them on a new line
|
||||
yield* fixToTypeImportDeclaration(fixer, report, sourceImports);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
function classifySpecifier(node) {
|
||||
const defaultSpecifier = node.specifiers[0].type === utils_1.AST_NODE_TYPES.ImportDefaultSpecifier
|
||||
? node.specifiers[0]
|
||||
: null;
|
||||
const namespaceSpecifier = node.specifiers.find((specifier) => specifier.type === utils_1.AST_NODE_TYPES.ImportNamespaceSpecifier) ?? null;
|
||||
const namedSpecifiers = node.specifiers.filter((specifier) => specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier);
|
||||
return {
|
||||
defaultSpecifier,
|
||||
namespaceSpecifier,
|
||||
namedSpecifiers,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Returns information for fixing named specifiers, type or value
|
||||
*/
|
||||
function getFixesNamedSpecifiers(fixer, node, subsetNamedSpecifiers, allNamedSpecifiers) {
|
||||
if (allNamedSpecifiers.length === 0) {
|
||||
return {
|
||||
typeNamedSpecifiersText: '',
|
||||
removeTypeNamedSpecifiers: [],
|
||||
};
|
||||
}
|
||||
const typeNamedSpecifiersTexts = [];
|
||||
const removeTypeNamedSpecifiers = [];
|
||||
if (subsetNamedSpecifiers.length === allNamedSpecifiers.length) {
|
||||
// import Foo, {Type1, Type2} from 'foo'
|
||||
// import DefType, {Type1, Type2} from 'foo'
|
||||
const openingBraceToken = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(subsetNamedSpecifiers[0], util_1.isOpeningBraceToken), util_1.NullThrowsReasons.MissingToken('{', node.type));
|
||||
const commaToken = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(openingBraceToken, util_1.isCommaToken), util_1.NullThrowsReasons.MissingToken(',', node.type));
|
||||
const closingBraceToken = (0, util_1.nullThrows)(context.sourceCode.getFirstTokenBetween(openingBraceToken, node.source, util_1.isClosingBraceToken), util_1.NullThrowsReasons.MissingToken('}', node.type));
|
||||
// import DefType, {...} from 'foo'
|
||||
// ^^^^^^^ remove
|
||||
removeTypeNamedSpecifiers.push(fixer.removeRange([commaToken.range[0], closingBraceToken.range[1]]));
|
||||
typeNamedSpecifiersTexts.push(context.sourceCode.text.slice(openingBraceToken.range[1], closingBraceToken.range[0]));
|
||||
}
|
||||
else {
|
||||
const namedSpecifierGroups = [];
|
||||
let group = [];
|
||||
for (const namedSpecifier of allNamedSpecifiers) {
|
||||
if (subsetNamedSpecifiers.includes(namedSpecifier)) {
|
||||
group.push(namedSpecifier);
|
||||
}
|
||||
else if (group.length) {
|
||||
namedSpecifierGroups.push(group);
|
||||
group = [];
|
||||
}
|
||||
}
|
||||
if (group.length) {
|
||||
namedSpecifierGroups.push(group);
|
||||
}
|
||||
for (const namedSpecifiers of namedSpecifierGroups) {
|
||||
const { removeRange, textRange } = getNamedSpecifierRanges(namedSpecifiers, allNamedSpecifiers);
|
||||
removeTypeNamedSpecifiers.push(fixer.removeRange(removeRange));
|
||||
typeNamedSpecifiersTexts.push(context.sourceCode.text.slice(...textRange));
|
||||
}
|
||||
}
|
||||
return {
|
||||
typeNamedSpecifiersText: typeNamedSpecifiersTexts.join(','),
|
||||
removeTypeNamedSpecifiers,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Returns ranges for fixing named specifier.
|
||||
*/
|
||||
function getNamedSpecifierRanges(namedSpecifierGroup, allNamedSpecifiers) {
|
||||
const first = namedSpecifierGroup[0];
|
||||
const last = namedSpecifierGroup[namedSpecifierGroup.length - 1];
|
||||
const removeRange = [first.range[0], last.range[1]];
|
||||
const textRange = [...removeRange];
|
||||
const before = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(first), util_1.NullThrowsReasons.MissingToken('token', 'first specifier'));
|
||||
textRange[0] = before.range[1];
|
||||
if ((0, util_1.isCommaToken)(before)) {
|
||||
removeRange[0] = before.range[0];
|
||||
}
|
||||
else {
|
||||
removeRange[0] = before.range[1];
|
||||
}
|
||||
const isFirst = allNamedSpecifiers[0] === first;
|
||||
const isLast = allNamedSpecifiers[allNamedSpecifiers.length - 1] === last;
|
||||
const after = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(last), util_1.NullThrowsReasons.MissingToken('token', 'last specifier'));
|
||||
textRange[1] = after.range[0];
|
||||
if (isFirst || isLast) {
|
||||
if ((0, util_1.isCommaToken)(after)) {
|
||||
removeRange[1] = after.range[1];
|
||||
}
|
||||
}
|
||||
return {
|
||||
textRange,
|
||||
removeRange,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* insert specifiers to named import node.
|
||||
* e.g.
|
||||
* import type { Already, Type1, Type2 } from 'foo'
|
||||
* ^^^^^^^^^^^^^ insert
|
||||
*/
|
||||
function fixInsertNamedSpecifiersInNamedSpecifierList(fixer, target, insertText) {
|
||||
const closingBraceToken = (0, util_1.nullThrows)(context.sourceCode.getFirstTokenBetween((0, util_1.nullThrows)(context.sourceCode.getFirstToken(target), util_1.NullThrowsReasons.MissingToken('token before', 'import')), target.source, util_1.isClosingBraceToken), util_1.NullThrowsReasons.MissingToken('}', target.type));
|
||||
const before = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(closingBraceToken), util_1.NullThrowsReasons.MissingToken('token before', 'closing brace'));
|
||||
if (!(0, util_1.isCommaToken)(before) && !(0, util_1.isOpeningBraceToken)(before)) {
|
||||
insertText = `,${insertText}`;
|
||||
}
|
||||
return fixer.insertTextBefore(closingBraceToken, insertText);
|
||||
}
|
||||
/**
|
||||
* insert type keyword to named import node.
|
||||
* e.g.
|
||||
* import ADefault, { Already, type Type1, type Type2 } from 'foo'
|
||||
* ^^^^ insert
|
||||
*/
|
||||
function* fixInsertTypeKeywordInNamedSpecifierList(fixer, typeSpecifiers) {
|
||||
for (const spec of typeSpecifiers) {
|
||||
const insertText = context.sourceCode.text.slice(...spec.range);
|
||||
yield fixer.replaceTextRange(spec.range, `type ${insertText}`);
|
||||
}
|
||||
}
|
||||
function* fixInlineTypeImportDeclaration(fixer, report, sourceImports) {
|
||||
const { node } = report;
|
||||
// For a value import, will only add an inline type to named specifiers
|
||||
const { namedSpecifiers } = classifySpecifier(node);
|
||||
const typeNamedSpecifiers = namedSpecifiers.filter(specifier => report.typeSpecifiers.includes(specifier));
|
||||
if (sourceImports.valueImport) {
|
||||
// add import named type specifiers to its value import
|
||||
// import ValueA, { type A }
|
||||
// ^^^^ insert
|
||||
const { namedSpecifiers: valueImportNamedSpecifiers } = classifySpecifier(sourceImports.valueImport);
|
||||
if (sourceImports.valueOnlyNamedImport ||
|
||||
valueImportNamedSpecifiers.length) {
|
||||
yield* fixInsertTypeKeywordInNamedSpecifierList(fixer, typeNamedSpecifiers);
|
||||
}
|
||||
}
|
||||
}
|
||||
function* fixToTypeImportDeclaration(fixer, report, sourceImports) {
|
||||
const { node } = report;
|
||||
const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } = classifySpecifier(node);
|
||||
if (namespaceSpecifier && !defaultSpecifier) {
|
||||
// import * as types from 'foo'
|
||||
// checks for presence of import assertions
|
||||
if (node.attributes.length === 0) {
|
||||
yield* fixInsertTypeSpecifierForImportDeclaration(fixer, node, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (defaultSpecifier) {
|
||||
if (report.typeSpecifiers.includes(defaultSpecifier) &&
|
||||
namedSpecifiers.length === 0 &&
|
||||
!namespaceSpecifier) {
|
||||
// import Type from 'foo'
|
||||
yield* fixInsertTypeSpecifierForImportDeclaration(fixer, node, true);
|
||||
return;
|
||||
}
|
||||
else if (fixStyle === 'inline-type-imports' &&
|
||||
!report.typeSpecifiers.includes(defaultSpecifier) &&
|
||||
namedSpecifiers.length > 0 &&
|
||||
!namespaceSpecifier) {
|
||||
// if there is a default specifier but it isn't a type specifier, then just add the inline type modifier to the named specifiers
|
||||
// import AValue, {BValue, Type1, Type2} from 'foo'
|
||||
yield* fixInlineTypeImportDeclaration(fixer, report, sourceImports);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!namespaceSpecifier) {
|
||||
if (fixStyle === 'inline-type-imports' &&
|
||||
namedSpecifiers.some(specifier => report.typeSpecifiers.includes(specifier))) {
|
||||
// import {AValue, Type1, Type2} from 'foo'
|
||||
yield* fixInlineTypeImportDeclaration(fixer, report, sourceImports);
|
||||
return;
|
||||
}
|
||||
else if (namedSpecifiers.every(specifier => report.typeSpecifiers.includes(specifier))) {
|
||||
// import {Type1, Type2} from 'foo'
|
||||
yield* fixInsertTypeSpecifierForImportDeclaration(fixer, node, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
const typeNamedSpecifiers = namedSpecifiers.filter(specifier => report.typeSpecifiers.includes(specifier));
|
||||
const fixesNamedSpecifiers = getFixesNamedSpecifiers(fixer, node, typeNamedSpecifiers, namedSpecifiers);
|
||||
const afterFixes = [];
|
||||
if (typeNamedSpecifiers.length) {
|
||||
if (sourceImports.typeOnlyNamedImport) {
|
||||
const insertTypeNamedSpecifiers = fixInsertNamedSpecifiersInNamedSpecifierList(fixer, sourceImports.typeOnlyNamedImport, fixesNamedSpecifiers.typeNamedSpecifiersText);
|
||||
if (sourceImports.typeOnlyNamedImport.range[1] <= node.range[0]) {
|
||||
yield insertTypeNamedSpecifiers;
|
||||
}
|
||||
else {
|
||||
afterFixes.push(insertTypeNamedSpecifiers);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// The import is both default and named. Insert named on new line because can't mix default type import and named type imports
|
||||
// eslint-disable-next-line no-lonely-if
|
||||
if (fixStyle === 'inline-type-imports') {
|
||||
yield fixer.insertTextBefore(node, `import {${typeNamedSpecifiers
|
||||
.map(spec => {
|
||||
const insertText = context.sourceCode.text.slice(...spec.range);
|
||||
return `type ${insertText}`;
|
||||
})
|
||||
.join(', ')}} from ${context.sourceCode.getText(node.source)};\n`);
|
||||
}
|
||||
else {
|
||||
yield fixer.insertTextBefore(node, `import type {${fixesNamedSpecifiers.typeNamedSpecifiersText}} from ${context.sourceCode.getText(node.source)};\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
const fixesRemoveTypeNamespaceSpecifier = [];
|
||||
if (namespaceSpecifier &&
|
||||
report.typeSpecifiers.includes(namespaceSpecifier)) {
|
||||
// import Foo, * as Type from 'foo'
|
||||
// import DefType, * as Type from 'foo'
|
||||
// import DefType, * as Type from 'foo'
|
||||
const commaToken = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(namespaceSpecifier, util_1.isCommaToken), util_1.NullThrowsReasons.MissingToken(',', node.type));
|
||||
// import Def, * as Ns from 'foo'
|
||||
// ^^^^^^^^^ remove
|
||||
fixesRemoveTypeNamespaceSpecifier.push(fixer.removeRange([commaToken.range[0], namespaceSpecifier.range[1]]));
|
||||
// import type * as Ns from 'foo'
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ insert
|
||||
yield fixer.insertTextBefore(node, `import type ${context.sourceCode.getText(namespaceSpecifier)} from ${context.sourceCode.getText(node.source)};\n`);
|
||||
}
|
||||
if (defaultSpecifier &&
|
||||
report.typeSpecifiers.includes(defaultSpecifier)) {
|
||||
if (report.typeSpecifiers.length === node.specifiers.length) {
|
||||
const importToken = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(node, util_1.isImportKeyword), util_1.NullThrowsReasons.MissingToken('import', node.type));
|
||||
// import type Type from 'foo'
|
||||
// ^^^^ insert
|
||||
yield fixer.insertTextAfter(importToken, ' type');
|
||||
}
|
||||
else {
|
||||
const commaToken = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(defaultSpecifier, util_1.isCommaToken), util_1.NullThrowsReasons.MissingToken(',', defaultSpecifier.type));
|
||||
// import Type , {...} from 'foo'
|
||||
// ^^^^^ pick
|
||||
const defaultText = context.sourceCode.text
|
||||
.slice(defaultSpecifier.range[0], commaToken.range[0])
|
||||
.trim();
|
||||
yield fixer.insertTextBefore(node, `import type ${defaultText} from ${context.sourceCode.getText(node.source)};\n`);
|
||||
const afterToken = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(commaToken, {
|
||||
includeComments: true,
|
||||
}), util_1.NullThrowsReasons.MissingToken('any token', node.type));
|
||||
// import Type , {...} from 'foo'
|
||||
// ^^^^^^^ remove
|
||||
yield fixer.removeRange([
|
||||
defaultSpecifier.range[0],
|
||||
afterToken.range[0],
|
||||
]);
|
||||
}
|
||||
}
|
||||
yield* fixesNamedSpecifiers.removeTypeNamedSpecifiers;
|
||||
yield* fixesRemoveTypeNamespaceSpecifier;
|
||||
yield* afterFixes;
|
||||
}
|
||||
function* fixInsertTypeSpecifierForImportDeclaration(fixer, node, isDefaultImport) {
|
||||
// import type Foo from 'foo'
|
||||
// ^^^^^ insert
|
||||
const importToken = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(node, util_1.isImportKeyword), util_1.NullThrowsReasons.MissingToken('import', node.type));
|
||||
yield fixer.insertTextAfter(importToken, ' type');
|
||||
if (isDefaultImport) {
|
||||
// Has default import
|
||||
const openingBraceToken = context.sourceCode.getFirstTokenBetween(importToken, node.source, util_1.isOpeningBraceToken);
|
||||
if (openingBraceToken) {
|
||||
// Only braces. e.g. import Foo, {} from 'foo'
|
||||
const commaToken = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(openingBraceToken, util_1.isCommaToken), util_1.NullThrowsReasons.MissingToken(',', node.type));
|
||||
const closingBraceToken = (0, util_1.nullThrows)(context.sourceCode.getFirstTokenBetween(openingBraceToken, node.source, util_1.isClosingBraceToken), util_1.NullThrowsReasons.MissingToken('}', node.type));
|
||||
// import type Foo, {} from 'foo'
|
||||
// ^^ remove
|
||||
yield fixer.removeRange([
|
||||
commaToken.range[0],
|
||||
closingBraceToken.range[1],
|
||||
]);
|
||||
const specifiersText = context.sourceCode.text.slice(commaToken.range[1], closingBraceToken.range[1]);
|
||||
if (node.specifiers.length > 1) {
|
||||
yield fixer.insertTextAfter(node, `\nimport type${specifiersText} from ${context.sourceCode.getText(node.source)};`);
|
||||
}
|
||||
}
|
||||
}
|
||||
// make sure we don't do anything like `import type {type T} from 'foo';`
|
||||
for (const specifier of node.specifiers) {
|
||||
if (specifier.type === utils_1.AST_NODE_TYPES.ImportSpecifier &&
|
||||
specifier.importKind === 'type') {
|
||||
yield* fixRemoveTypeSpecifierFromImportSpecifier(fixer, specifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
function* fixRemoveTypeSpecifierFromImportDeclaration(fixer, node) {
|
||||
// import type Foo from 'foo'
|
||||
// ^^^^ remove
|
||||
const importToken = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(node, util_1.isImportKeyword), util_1.NullThrowsReasons.MissingToken('import', node.type));
|
||||
const typeToken = (0, util_1.nullThrows)(context.sourceCode.getFirstTokenBetween(importToken, node.specifiers[0]?.local ?? node.source, util_1.isTypeKeyword), util_1.NullThrowsReasons.MissingToken('type', node.type));
|
||||
const afterToken = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(typeToken, { includeComments: true }), util_1.NullThrowsReasons.MissingToken('any token', node.type));
|
||||
yield fixer.removeRange([typeToken.range[0], afterToken.range[0]]);
|
||||
}
|
||||
function* fixRemoveTypeSpecifierFromImportSpecifier(fixer, node) {
|
||||
// import { type Foo } from 'foo'
|
||||
// ^^^^ remove
|
||||
const typeToken = (0, util_1.nullThrows)(context.sourceCode.getFirstToken(node, util_1.isTypeKeyword), util_1.NullThrowsReasons.MissingToken('type', node.type));
|
||||
const afterToken = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(typeToken, { includeComments: true }), util_1.NullThrowsReasons.MissingToken('any token', node.type));
|
||||
yield fixer.removeRange([typeToken.range[0], afterToken.range[0]]);
|
||||
}
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=consistent-type-imports.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-imports.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-imports.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
68
node_modules/@typescript-eslint/eslint-plugin/dist/rules/default-param-last.js
generated
vendored
Normal file
68
node_modules/@typescript-eslint/eslint-plugin/dist/rules/default-param-last.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'default-param-last',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce default parameters to be last',
|
||||
extendsBaseRule: true,
|
||||
},
|
||||
schema: [],
|
||||
messages: {
|
||||
shouldBeLast: 'Default parameters should be last.',
|
||||
},
|
||||
},
|
||||
defaultOptions: [],
|
||||
create(context) {
|
||||
/**
|
||||
* checks if node is optional parameter
|
||||
* @param node the node to be evaluated
|
||||
* @private
|
||||
*/
|
||||
function isOptionalParam(node) {
|
||||
return ((node.type === utils_1.AST_NODE_TYPES.ArrayPattern ||
|
||||
node.type === utils_1.AST_NODE_TYPES.AssignmentPattern ||
|
||||
node.type === utils_1.AST_NODE_TYPES.Identifier ||
|
||||
node.type === utils_1.AST_NODE_TYPES.ObjectPattern ||
|
||||
node.type === utils_1.AST_NODE_TYPES.RestElement) &&
|
||||
node.optional);
|
||||
}
|
||||
/**
|
||||
* checks if node is plain parameter
|
||||
* @param node the node to be evaluated
|
||||
* @private
|
||||
*/
|
||||
function isPlainParam(node) {
|
||||
return !(node.type === utils_1.AST_NODE_TYPES.AssignmentPattern ||
|
||||
node.type === utils_1.AST_NODE_TYPES.RestElement ||
|
||||
isOptionalParam(node));
|
||||
}
|
||||
function checkDefaultParamLast(node) {
|
||||
let hasSeenPlainParam = false;
|
||||
for (let i = node.params.length - 1; i >= 0; i--) {
|
||||
const current = node.params[i];
|
||||
const param = current.type === utils_1.AST_NODE_TYPES.TSParameterProperty
|
||||
? current.parameter
|
||||
: current;
|
||||
if (isPlainParam(param)) {
|
||||
hasSeenPlainParam = true;
|
||||
continue;
|
||||
}
|
||||
if (hasSeenPlainParam &&
|
||||
(isOptionalParam(param) ||
|
||||
param.type === utils_1.AST_NODE_TYPES.AssignmentPattern)) {
|
||||
context.report({ node: current, messageId: 'shouldBeLast' });
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
ArrowFunctionExpression: checkDefaultParamLast,
|
||||
FunctionDeclaration: checkDefaultParamLast,
|
||||
FunctionExpression: checkDefaultParamLast,
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=default-param-last.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/default-param-last.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/default-param-last.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"default-param-last.js","sourceRoot":"","sources":["../../src/rules/default-param-last.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAAqC;AAErC,kBAAe,IAAA,iBAAU,EAAC;IACxB,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE;QACJ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AAI,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;oBACxB,iBAAiB,GAAG,IAAI,CAAC;oBACzB,SAAS;gBACX,CAAC;gBAED,IACE,iBAAiB;oBACjB,CAAC,eAAe,CAAC,KAAK,CAAC;wBACrB,KAAK,CAAC,IAAI,KAAK,sBAAc,CAAC,iBAAiB,CAAC,EAClD,CAAC;oBACD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC;gBAC/D,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO;YACL,uBAAuB,EAAE,qBAAqB;YAC9C,mBAAmB,EAAE,qBAAqB;YAC1C,kBAAkB,EAAE,qBAAqB;SAC1C,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
127
node_modules/@typescript-eslint/eslint-plugin/dist/rules/dot-notation.js
generated
vendored
Normal file
127
node_modules/@typescript-eslint/eslint-plugin/dist/rules/dot-notation.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../util");
|
||||
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
|
||||
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('dot-notation');
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'dot-notation',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce dot notation whenever possible',
|
||||
recommended: 'stylistic',
|
||||
extendsBaseRule: true,
|
||||
requiresTypeChecking: true,
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
allowKeywords: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
allowPattern: {
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
allowPrivateClassPropertyAccess: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
allowProtectedClassPropertyAccess: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
allowIndexSignaturePropertyAccess: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
fixable: baseRule.meta.fixable,
|
||||
hasSuggestions: baseRule.meta.hasSuggestions,
|
||||
messages: baseRule.meta.messages,
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
allowPrivateClassPropertyAccess: false,
|
||||
allowProtectedClassPropertyAccess: false,
|
||||
allowIndexSignaturePropertyAccess: false,
|
||||
allowKeywords: true,
|
||||
allowPattern: '',
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
const rules = baseRule.create(context);
|
||||
const services = (0, util_1.getParserServices)(context);
|
||||
const allowPrivateClassPropertyAccess = options.allowPrivateClassPropertyAccess;
|
||||
const allowProtectedClassPropertyAccess = options.allowProtectedClassPropertyAccess;
|
||||
const allowIndexSignaturePropertyAccess = (options.allowIndexSignaturePropertyAccess ?? false) ||
|
||||
tsutils.isCompilerOptionEnabled(services.program.getCompilerOptions(), 'noPropertyAccessFromIndexSignature');
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
if ((allowPrivateClassPropertyAccess ||
|
||||
allowProtectedClassPropertyAccess ||
|
||||
allowIndexSignaturePropertyAccess) &&
|
||||
node.computed) {
|
||||
// for perf reasons - only fetch symbols if we have to
|
||||
const propertySymbol = services.getSymbolAtLocation(node.property) ??
|
||||
services
|
||||
.getTypeAtLocation(node.object)
|
||||
.getNonNullableType()
|
||||
.getProperties()
|
||||
.find(propertySymbol => node.property.type === utils_1.AST_NODE_TYPES.Literal &&
|
||||
propertySymbol.escapedName === node.property.value);
|
||||
const modifierKind = (0, util_1.getModifiers)(propertySymbol?.getDeclarations()?.[0])?.[0].kind;
|
||||
if ((allowPrivateClassPropertyAccess &&
|
||||
modifierKind === ts.SyntaxKind.PrivateKeyword) ||
|
||||
(allowProtectedClassPropertyAccess &&
|
||||
modifierKind === ts.SyntaxKind.ProtectedKeyword)) {
|
||||
return;
|
||||
}
|
||||
if (propertySymbol === undefined &&
|
||||
allowIndexSignaturePropertyAccess) {
|
||||
const objectType = services.getTypeAtLocation(node.object);
|
||||
const indexType = objectType
|
||||
.getNonNullableType()
|
||||
.getStringIndexType();
|
||||
if (indexType !== undefined) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
rules.MemberExpression(node);
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=dot-notation.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/dot-notation.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/dot-notation.js.map
generated
vendored
Normal file
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U,CAAC,cAAc,CAAC;wBAChD,CAAC,iCAAiC;4BAChC,YAAY,KAAK,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAClD,CAAC;wBACD,OAAO;oBACT,CAAC;oBACD,IACE,cAAc,KAAK,SAAS;wBAC5B,iCAAiC,EACjC,CAAC;wBACD,MAAM,UAAU,GAAG,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;wBAC3D,MAAM,SAAS,GAAG,UAAU;6BACzB,kBAAkB,EAAE;6BACpB,kBAAkB,EAAE,CAAC;wBACxB,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;4BAC5B,OAAO;wBACT,CAAC;oBACH,CAAC;gBACH,CAAC;gBACD,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
112
node_modules/@typescript-eslint/eslint-plugin/dist/rules/enum-utils/shared.js
generated
vendored
Normal file
112
node_modules/@typescript-eslint/eslint-plugin/dist/rules/enum-utils/shared.js
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getEnumLiterals = getEnumLiterals;
|
||||
exports.getEnumTypes = getEnumTypes;
|
||||
exports.getEnumKeyForLiteral = getEnumKeyForLiteral;
|
||||
const tsutils = __importStar(require("ts-api-utils"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util_1 = require("../../util");
|
||||
/*
|
||||
* If passed an enum member, returns the type of the parent. Otherwise,
|
||||
* returns itself.
|
||||
*
|
||||
* For example:
|
||||
* - `Fruit` --> `Fruit`
|
||||
* - `Fruit.Apple` --> `Fruit`
|
||||
*/
|
||||
function getBaseEnumType(typeChecker, type) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const symbol = type.getSymbol();
|
||||
if (!tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.EnumMember)) {
|
||||
return type;
|
||||
}
|
||||
return typeChecker.getTypeAtLocation(symbol.valueDeclaration.parent);
|
||||
}
|
||||
/**
|
||||
* Retrieve only the Enum literals from a type. for example:
|
||||
* - 123 --> []
|
||||
* - {} --> []
|
||||
* - Fruit.Apple --> [Fruit.Apple]
|
||||
* - Fruit.Apple | Vegetable.Lettuce --> [Fruit.Apple, Vegetable.Lettuce]
|
||||
* - Fruit.Apple | Vegetable.Lettuce | 123 --> [Fruit.Apple, Vegetable.Lettuce]
|
||||
* - T extends Fruit --> [Fruit]
|
||||
*/
|
||||
function getEnumLiterals(type) {
|
||||
return tsutils
|
||||
.unionTypeParts(type)
|
||||
.filter((subType) => (0, util_1.isTypeFlagSet)(subType, ts.TypeFlags.EnumLiteral));
|
||||
}
|
||||
/**
|
||||
* A type can have 0 or more enum types. For example:
|
||||
* - 123 --> []
|
||||
* - {} --> []
|
||||
* - Fruit.Apple --> [Fruit]
|
||||
* - Fruit.Apple | Vegetable.Lettuce --> [Fruit, Vegetable]
|
||||
* - Fruit.Apple | Vegetable.Lettuce | 123 --> [Fruit, Vegetable]
|
||||
* - T extends Fruit --> [Fruit]
|
||||
*/
|
||||
function getEnumTypes(typeChecker, type) {
|
||||
return getEnumLiterals(type).map(type => getBaseEnumType(typeChecker, type));
|
||||
}
|
||||
/**
|
||||
* Returns the enum key that matches the given literal node, or null if none
|
||||
* match. For example:
|
||||
* ```ts
|
||||
* enum Fruit {
|
||||
* Apple = 'apple',
|
||||
* Banana = 'banana',
|
||||
* }
|
||||
*
|
||||
* getEnumKeyForLiteral([Fruit.Apple, Fruit.Banana], 'apple') --> 'Fruit.Apple'
|
||||
* getEnumKeyForLiteral([Fruit.Apple, Fruit.Banana], 'banana') --> 'Fruit.Banana'
|
||||
* getEnumKeyForLiteral([Fruit.Apple, Fruit.Banana], 'cherry') --> null
|
||||
* ```
|
||||
*/
|
||||
function getEnumKeyForLiteral(enumLiterals, literal) {
|
||||
for (const enumLiteral of enumLiterals) {
|
||||
if (enumLiteral.value === literal) {
|
||||
const { symbol } = enumLiteral;
|
||||
const memberDeclaration = symbol.valueDeclaration;
|
||||
const enumDeclaration = memberDeclaration.parent;
|
||||
const memberNameIdentifier = memberDeclaration.name;
|
||||
const enumName = enumDeclaration.name.text;
|
||||
switch (memberNameIdentifier.kind) {
|
||||
case ts.SyntaxKind.Identifier:
|
||||
return `${enumName}.${memberNameIdentifier.text}`;
|
||||
case ts.SyntaxKind.StringLiteral: {
|
||||
const memberName = memberNameIdentifier.text.replace(/'/g, "\\'");
|
||||
return `${enumName}['${memberName}']`;
|
||||
}
|
||||
case ts.SyntaxKind.ComputedPropertyName:
|
||||
return `${enumName}[${memberNameIdentifier.expression.getText()}]`;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//# sourceMappingURL=shared.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/enum-utils/shared.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/enum-utils/shared.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/rules/enum-utils/shared.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,0CAMC;AAWD,oCAKC;AAgBD,oDAkCC;AA1GD,sDAAwC;AACxC,+CAAiC;AAEjC,qCAA2C;AAE3C;;;;;;;GAOG;AACH,SAAS,eAAe,CAAC,WAA2B,EAAE,IAAa;IACjE,oEAAoE;IACpE,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAG,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,WAAW,CAAC,iBAAiB,CACjC,MAAM,CAAC,gBAAkC,CAAC,MAAM,CAClD,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAAC,IAAa;IAC3C,OAAO,OAAO;SACX,cAAc,CAAC,IAAI,CAAC;SACpB,MAAM,CAAC,CAAC,OAAO,EAA6B,EAAE,CAC7C,IAAA,oBAAa,EAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CACjD,CAAC;AACN,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAC1B,WAA2B,EAC3B,IAAa;IAEb,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAgB,oBAAoB,CAClC,YAA8B,EAC9B,OAAgB;IAEhB,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,IAAI,WAAW,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;YAClC,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;YAE/B,MAAM,iBAAiB,GAAG,MAAM,CAAC,gBAAiC,CAAC;YACnE,MAAM,eAAe,GAAG,iBAAiB,CAAC,MAAM,CAAC;YAEjD,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,IAAI,CAAC;YACpD,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;YAE3C,QAAQ,oBAAoB,CAAC,IAAI,EAAE,CAAC;gBAClC,KAAK,EAAE,CAAC,UAAU,CAAC,UAAU;oBAC3B,OAAO,GAAG,QAAQ,IAAI,oBAAoB,CAAC,IAAI,EAAE,CAAC;gBAEpD,KAAK,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC;oBACjC,MAAM,UAAU,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;oBAElE,OAAO,GAAG,QAAQ,KAAK,UAAU,IAAI,CAAC;gBACxC,CAAC;gBAED,KAAK,EAAE,CAAC,UAAU,CAAC,oBAAoB;oBACrC,OAAO,GAAG,QAAQ,IAAI,oBAAoB,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC;gBAErE;oBACE,MAAM;YACV,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
||||
180
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-function-return-type.js
generated
vendored
Normal file
180
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-function-return-type.js
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
const explicitReturnTypeUtils_1 = require("../util/explicitReturnTypeUtils");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'explicit-function-return-type',
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Require explicit return types on functions and class methods',
|
||||
},
|
||||
messages: {
|
||||
missingReturnType: 'Missing return type on function.',
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
allowConciseArrowFunctionExpressionsStartingWithVoid: {
|
||||
description: 'Whether to allow arrow functions that start with the `void` keyword.',
|
||||
type: 'boolean',
|
||||
},
|
||||
allowExpressions: {
|
||||
description: 'Whether to ignore function expressions (functions which are not part of a declaration).',
|
||||
type: 'boolean',
|
||||
},
|
||||
allowHigherOrderFunctions: {
|
||||
description: 'Whether to ignore functions immediately returning another function expression.',
|
||||
type: 'boolean',
|
||||
},
|
||||
allowTypedFunctionExpressions: {
|
||||
description: 'Whether to ignore type annotations on the variable of function expressions.',
|
||||
type: 'boolean',
|
||||
},
|
||||
allowDirectConstAssertionInArrowFunctions: {
|
||||
description: 'Whether to ignore arrow functions immediately returning a `as const` value.',
|
||||
type: 'boolean',
|
||||
},
|
||||
allowFunctionsWithoutTypeParameters: {
|
||||
description: "Whether to ignore functions that don't have generic type parameters.",
|
||||
type: 'boolean',
|
||||
},
|
||||
allowedNames: {
|
||||
description: 'An array of function/method names that will not have their arguments or return values checked.',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
type: 'array',
|
||||
},
|
||||
allowIIFEs: {
|
||||
description: 'Whether to ignore immediately invoked function expressions (IIFEs).',
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
allowExpressions: false,
|
||||
allowTypedFunctionExpressions: true,
|
||||
allowHigherOrderFunctions: true,
|
||||
allowDirectConstAssertionInArrowFunctions: true,
|
||||
allowConciseArrowFunctionExpressionsStartingWithVoid: false,
|
||||
allowFunctionsWithoutTypeParameters: false,
|
||||
allowedNames: [],
|
||||
allowIIFEs: false,
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
const functionInfoStack = [];
|
||||
function enterFunction(node) {
|
||||
functionInfoStack.push({
|
||||
node,
|
||||
returns: [],
|
||||
});
|
||||
}
|
||||
function popFunctionInfo(exitNodeType) {
|
||||
return (0, util_1.nullThrows)(functionInfoStack.pop(), `Stack should exist on ${exitNodeType} exit`);
|
||||
}
|
||||
function isAllowedFunction(node) {
|
||||
if (options.allowFunctionsWithoutTypeParameters && !node.typeParameters) {
|
||||
return true;
|
||||
}
|
||||
if (options.allowIIFEs && isIIFE(node)) {
|
||||
return true;
|
||||
}
|
||||
if (!options.allowedNames?.length) {
|
||||
return false;
|
||||
}
|
||||
if (node.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression ||
|
||||
node.type === utils_1.AST_NODE_TYPES.FunctionExpression) {
|
||||
const parent = node.parent;
|
||||
let funcName;
|
||||
if (node.id?.name) {
|
||||
funcName = node.id.name;
|
||||
}
|
||||
else {
|
||||
switch (parent.type) {
|
||||
case utils_1.AST_NODE_TYPES.VariableDeclarator: {
|
||||
if (parent.id.type === utils_1.AST_NODE_TYPES.Identifier) {
|
||||
funcName = parent.id.name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case utils_1.AST_NODE_TYPES.MethodDefinition:
|
||||
case utils_1.AST_NODE_TYPES.PropertyDefinition:
|
||||
case utils_1.AST_NODE_TYPES.Property: {
|
||||
if (parent.key.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
!parent.computed) {
|
||||
funcName = parent.key.name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!!funcName && !!options.allowedNames.includes(funcName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (node.type === utils_1.AST_NODE_TYPES.FunctionDeclaration &&
|
||||
node.id &&
|
||||
!!options.allowedNames.includes(node.id.name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isIIFE(node) {
|
||||
return node.parent.type === utils_1.AST_NODE_TYPES.CallExpression;
|
||||
}
|
||||
function exitFunctionExpression(node) {
|
||||
const info = popFunctionInfo('function expression');
|
||||
if (options.allowConciseArrowFunctionExpressionsStartingWithVoid &&
|
||||
node.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression &&
|
||||
node.expression &&
|
||||
node.body.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
|
||||
node.body.operator === 'void') {
|
||||
return;
|
||||
}
|
||||
if (isAllowedFunction(node)) {
|
||||
return;
|
||||
}
|
||||
if (options.allowTypedFunctionExpressions &&
|
||||
((0, explicitReturnTypeUtils_1.isValidFunctionExpressionReturnType)(node, options) ||
|
||||
(0, explicitReturnTypeUtils_1.ancestorHasReturnType)(node))) {
|
||||
return;
|
||||
}
|
||||
(0, explicitReturnTypeUtils_1.checkFunctionReturnType)(info, options, context.sourceCode, loc => context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId: 'missingReturnType',
|
||||
}));
|
||||
}
|
||||
return {
|
||||
'ArrowFunctionExpression, FunctionExpression, FunctionDeclaration': enterFunction,
|
||||
'ArrowFunctionExpression:exit': exitFunctionExpression,
|
||||
'FunctionExpression:exit': exitFunctionExpression,
|
||||
'FunctionDeclaration:exit'(node) {
|
||||
const info = popFunctionInfo('function declaration');
|
||||
if (isAllowedFunction(node)) {
|
||||
return;
|
||||
}
|
||||
if (options.allowTypedFunctionExpressions && node.returnType) {
|
||||
return;
|
||||
}
|
||||
(0, explicitReturnTypeUtils_1.checkFunctionReturnType)(info, options, context.sourceCode, loc => context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId: 'missingReturnType',
|
||||
}));
|
||||
},
|
||||
ReturnStatement(node) {
|
||||
functionInfoStack.at(-1)?.returns.push(node);
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=explicit-function-return-type.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-function-return-type.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-function-return-type.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"explicit-function-return-type.js","sourceRoot":"","sources":["../../src/rules/explicit-function-return-type.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAE1D,kCAAiD;AAEjD,6EAIyC;AAqBzC,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,8DAA8D;SACjE;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,kCAAkC;SACtD;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,oDAAoD,EAAE;wBACpD,WAAW,EACT,sEAAsE;wBACxE,IAAI,EAAE,SAAS;qBAChB;oBACD,gBAAgB,EAAE;wBAChB,WAAW,EACT,yFAAyF;wBAC3F,IAAI,EAAE,SAAS;qBAChB;oBACD,yBAAyB,EAAE;wBACzB,WAAW,EACT,gFAAgF;wBAClF,IAAI,EAAE,SAAS;qBAChB;oBACD,6BAA6B,EAAE;wBAC7B,WAAW,EACT,6EAA6E;wBAC/E,IAAI,EAAE,SAAS;qBAChB;oBACD,yCAAyC,EAAE;wBACzC,WAAW,EACT,6EAA6E;wBAC/E,IAAI,EAAE,SAAS;qBAChB;oBACD,mCAAmC,EAAE;wBACnC,WAAW,EACT,sEAAsE;wBACxE,IAAI,EAAE,SAAS;qBAChB;oBACD,YAAY,EAAE;wBACZ,WAAW,EACT,gGAAgG;wBAClG,KAAK,EAAE;4BACL,IAAI,EAAE,QAAQ;yBACf;wBACD,IAAI,EAAE,OAAO;qBACd;oBACD,UAAU,EAAE;wBACV,WAAW,EACT,qEAAqE;wBACvE,IAAI,EAAE,SAAS;qBAChB;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5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GAAG,CAAC,EAAE,CAC/D,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI;oBACJ,GAAG;oBACH,SAAS,EAAE,mBAAmB;iBAC/B,CAAC,CACH,CAAC;YACJ,CAAC;YACD,eAAe,CAAC,IAAI;gBAClB,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/C,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
293
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-member-accessibility.js
generated
vendored
Normal file
293
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-member-accessibility.js
generated
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
const getMemberHeadLoc_1 = require("../util/getMemberHeadLoc");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'explicit-member-accessibility',
|
||||
meta: {
|
||||
hasSuggestions: true,
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Require explicit accessibility modifiers on class properties and methods',
|
||||
// too opinionated to be recommended
|
||||
},
|
||||
fixable: 'code',
|
||||
messages: {
|
||||
missingAccessibility: 'Missing accessibility modifier on {{type}} {{name}}.',
|
||||
unwantedPublicAccessibility: 'Public accessibility modifier on {{type}} {{name}}.',
|
||||
addExplicitAccessibility: "Add '{{ type }}' accessibility modifier",
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
$defs: {
|
||||
accessibilityLevel: {
|
||||
oneOf: [
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['explicit'],
|
||||
description: 'Always require an accessor.',
|
||||
},
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['no-public'],
|
||||
description: 'Require an accessor except when public.',
|
||||
},
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['off'],
|
||||
description: 'Never check whether there is an accessor.',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
type: 'object',
|
||||
properties: {
|
||||
accessibility: { $ref: '#/items/0/$defs/accessibilityLevel' },
|
||||
overrides: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
accessors: { $ref: '#/items/0/$defs/accessibilityLevel' },
|
||||
constructors: { $ref: '#/items/0/$defs/accessibilityLevel' },
|
||||
methods: { $ref: '#/items/0/$defs/accessibilityLevel' },
|
||||
properties: { $ref: '#/items/0/$defs/accessibilityLevel' },
|
||||
parameterProperties: {
|
||||
$ref: '#/items/0/$defs/accessibilityLevel',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
ignoredMethodNames: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [{ accessibility: 'explicit' }],
|
||||
create(context, [option]) {
|
||||
const baseCheck = option.accessibility ?? 'explicit';
|
||||
const overrides = option.overrides ?? {};
|
||||
const ctorCheck = overrides.constructors ?? baseCheck;
|
||||
const accessorCheck = overrides.accessors ?? baseCheck;
|
||||
const methodCheck = overrides.methods ?? baseCheck;
|
||||
const propCheck = overrides.properties ?? baseCheck;
|
||||
const paramPropCheck = overrides.parameterProperties ?? baseCheck;
|
||||
const ignoredMethodNames = new Set(option.ignoredMethodNames ?? []);
|
||||
/**
|
||||
* Checks if a method declaration has an accessibility modifier.
|
||||
* @param methodDefinition The node representing a MethodDefinition.
|
||||
*/
|
||||
function checkMethodAccessibilityModifier(methodDefinition) {
|
||||
if (methodDefinition.key.type === utils_1.AST_NODE_TYPES.PrivateIdentifier) {
|
||||
return;
|
||||
}
|
||||
let nodeType = 'method definition';
|
||||
let check = baseCheck;
|
||||
switch (methodDefinition.kind) {
|
||||
case 'method':
|
||||
check = methodCheck;
|
||||
break;
|
||||
case 'constructor':
|
||||
check = ctorCheck;
|
||||
break;
|
||||
case 'get':
|
||||
case 'set':
|
||||
check = accessorCheck;
|
||||
nodeType = `${methodDefinition.kind} property accessor`;
|
||||
break;
|
||||
}
|
||||
const { name: methodName } = (0, util_1.getNameFromMember)(methodDefinition, context.sourceCode);
|
||||
if (check === 'off' || ignoredMethodNames.has(methodName)) {
|
||||
return;
|
||||
}
|
||||
if (check === 'no-public' &&
|
||||
methodDefinition.accessibility === 'public') {
|
||||
const publicKeyword = findPublicKeyword(methodDefinition);
|
||||
context.report({
|
||||
loc: rangeToLoc(context.sourceCode, publicKeyword.range),
|
||||
messageId: 'unwantedPublicAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
name: methodName,
|
||||
},
|
||||
fix: fixer => fixer.removeRange(publicKeyword.rangeToRemove),
|
||||
});
|
||||
}
|
||||
else if (check === 'explicit' && !methodDefinition.accessibility) {
|
||||
context.report({
|
||||
loc: (0, getMemberHeadLoc_1.getMemberHeadLoc)(context.sourceCode, methodDefinition),
|
||||
messageId: 'missingAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
name: methodName,
|
||||
},
|
||||
suggest: getMissingAccessibilitySuggestions(methodDefinition),
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns an object containing a range that corresponds to the "public"
|
||||
* keyword for a node, and the range that would need to be removed to
|
||||
* remove the "public" keyword (including associated whitespace).
|
||||
*/
|
||||
function findPublicKeyword(node) {
|
||||
const tokens = context.sourceCode.getTokens(node);
|
||||
let rangeToRemove;
|
||||
let keywordRange;
|
||||
for (let i = 0; i < tokens.length; i++) {
|
||||
const token = tokens[i];
|
||||
if (token.type === utils_1.AST_TOKEN_TYPES.Keyword &&
|
||||
token.value === 'public') {
|
||||
keywordRange = structuredClone(token.range);
|
||||
const commensAfterPublicKeyword = context.sourceCode.getCommentsAfter(token);
|
||||
if (commensAfterPublicKeyword.length) {
|
||||
// public /* Hi there! */ static foo()
|
||||
// ^^^^^^^
|
||||
rangeToRemove = [
|
||||
token.range[0],
|
||||
commensAfterPublicKeyword[0].range[0],
|
||||
];
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// public static foo()
|
||||
// ^^^^^^^
|
||||
rangeToRemove = [token.range[0], tokens[i + 1].range[0]];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return { range: keywordRange, rangeToRemove };
|
||||
}
|
||||
/**
|
||||
* Creates a fixer that adds an accessibility modifier keyword
|
||||
*/
|
||||
function getMissingAccessibilitySuggestions(node) {
|
||||
function fix(accessibility, fixer) {
|
||||
if (node.decorators.length) {
|
||||
const lastDecorator = node.decorators[node.decorators.length - 1];
|
||||
const nextToken = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(lastDecorator), util_1.NullThrowsReasons.MissingToken('token', 'last decorator'));
|
||||
return fixer.insertTextBefore(nextToken, `${accessibility} `);
|
||||
}
|
||||
return fixer.insertTextBefore(node, `${accessibility} `);
|
||||
}
|
||||
return [
|
||||
{
|
||||
messageId: 'addExplicitAccessibility',
|
||||
data: { type: 'public' },
|
||||
fix: fixer => fix('public', fixer),
|
||||
},
|
||||
{
|
||||
messageId: 'addExplicitAccessibility',
|
||||
data: { type: 'private' },
|
||||
fix: fixer => fix('private', fixer),
|
||||
},
|
||||
{
|
||||
messageId: 'addExplicitAccessibility',
|
||||
data: { type: 'protected' },
|
||||
fix: fixer => fix('protected', fixer),
|
||||
},
|
||||
];
|
||||
}
|
||||
/**
|
||||
* Checks if property has an accessibility modifier.
|
||||
* @param propertyDefinition The node representing a PropertyDefinition.
|
||||
*/
|
||||
function checkPropertyAccessibilityModifier(propertyDefinition) {
|
||||
if (propertyDefinition.key.type === utils_1.AST_NODE_TYPES.PrivateIdentifier) {
|
||||
return;
|
||||
}
|
||||
const nodeType = 'class property';
|
||||
const { name: propertyName } = (0, util_1.getNameFromMember)(propertyDefinition, context.sourceCode);
|
||||
if (propCheck === 'no-public' &&
|
||||
propertyDefinition.accessibility === 'public') {
|
||||
const publicKeywordRange = findPublicKeyword(propertyDefinition);
|
||||
context.report({
|
||||
loc: rangeToLoc(context.sourceCode, publicKeywordRange.range),
|
||||
messageId: 'unwantedPublicAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
name: propertyName,
|
||||
},
|
||||
fix: fixer => fixer.removeRange(publicKeywordRange.rangeToRemove),
|
||||
});
|
||||
}
|
||||
else if (propCheck === 'explicit' &&
|
||||
!propertyDefinition.accessibility) {
|
||||
context.report({
|
||||
loc: (0, getMemberHeadLoc_1.getMemberHeadLoc)(context.sourceCode, propertyDefinition),
|
||||
messageId: 'missingAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
name: propertyName,
|
||||
},
|
||||
suggest: getMissingAccessibilitySuggestions(propertyDefinition),
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Checks that the parameter property has the desired accessibility modifiers set.
|
||||
* @param node The node representing a Parameter Property
|
||||
*/
|
||||
function checkParameterPropertyAccessibilityModifier(node) {
|
||||
const nodeType = 'parameter property';
|
||||
// HAS to be an identifier or assignment or TSC will throw
|
||||
if (node.parameter.type !== utils_1.AST_NODE_TYPES.Identifier &&
|
||||
node.parameter.type !== utils_1.AST_NODE_TYPES.AssignmentPattern) {
|
||||
return;
|
||||
}
|
||||
const nodeName = node.parameter.type === utils_1.AST_NODE_TYPES.Identifier
|
||||
? node.parameter.name
|
||||
: // has to be an Identifier or TSC will throw an error
|
||||
node.parameter.left.name;
|
||||
switch (paramPropCheck) {
|
||||
case 'explicit': {
|
||||
if (!node.accessibility) {
|
||||
context.report({
|
||||
loc: (0, getMemberHeadLoc_1.getParameterPropertyHeadLoc)(context.sourceCode, node, nodeName),
|
||||
messageId: 'missingAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
name: nodeName,
|
||||
},
|
||||
suggest: getMissingAccessibilitySuggestions(node),
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'no-public': {
|
||||
if (node.accessibility === 'public' && node.readonly) {
|
||||
const publicKeyword = findPublicKeyword(node);
|
||||
context.report({
|
||||
loc: rangeToLoc(context.sourceCode, publicKeyword.range),
|
||||
messageId: 'unwantedPublicAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
name: nodeName,
|
||||
},
|
||||
fix: fixer => fixer.removeRange(publicKeyword.rangeToRemove),
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
'MethodDefinition, TSAbstractMethodDefinition': checkMethodAccessibilityModifier,
|
||||
'PropertyDefinition, TSAbstractPropertyDefinition': checkPropertyAccessibilityModifier,
|
||||
TSParameterProperty: checkParameterPropertyAccessibilityModifier,
|
||||
};
|
||||
},
|
||||
});
|
||||
function rangeToLoc(sourceCode, range) {
|
||||
return {
|
||||
start: sourceCode.getLocFromIndex(range[0]),
|
||||
end: sourceCode.getLocFromIndex(range[1]),
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=explicit-member-accessibility.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-member-accessibility.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-member-accessibility.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
386
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-module-boundary-types.js
generated
vendored
Normal file
386
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-module-boundary-types.js
generated
vendored
Normal file
@@ -0,0 +1,386 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const scope_manager_1 = require("@typescript-eslint/scope-manager");
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
const explicitReturnTypeUtils_1 = require("../util/explicitReturnTypeUtils");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'explicit-module-boundary-types',
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: "Require explicit return and argument types on exported functions' and classes' public class methods",
|
||||
},
|
||||
messages: {
|
||||
missingReturnType: 'Missing return type on function.',
|
||||
missingArgType: "Argument '{{name}}' should be typed.",
|
||||
missingArgTypeUnnamed: '{{type}} argument should be typed.',
|
||||
anyTypedArg: "Argument '{{name}}' should be typed with a non-any type.",
|
||||
anyTypedArgUnnamed: '{{type}} argument should be typed with a non-any type.',
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
allowArgumentsExplicitlyTypedAsAny: {
|
||||
description: 'Whether to ignore arguments that are explicitly typed as `any`.',
|
||||
type: 'boolean',
|
||||
},
|
||||
allowDirectConstAssertionInArrowFunctions: {
|
||||
description: [
|
||||
'Whether to ignore return type annotations on body-less arrow functions that return an `as const` type assertion.',
|
||||
'You must still type the parameters of the function.',
|
||||
].join('\n'),
|
||||
type: 'boolean',
|
||||
},
|
||||
allowedNames: {
|
||||
description: 'An array of function/method names that will not have their arguments or return values checked.',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
type: 'array',
|
||||
},
|
||||
allowHigherOrderFunctions: {
|
||||
description: [
|
||||
'Whether to ignore return type annotations on functions immediately returning another function expression.',
|
||||
'You must still type the parameters of the function.',
|
||||
].join('\n'),
|
||||
type: 'boolean',
|
||||
},
|
||||
allowTypedFunctionExpressions: {
|
||||
description: 'Whether to ignore type annotations on the variable of a function expression.',
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
allowArgumentsExplicitlyTypedAsAny: false,
|
||||
allowDirectConstAssertionInArrowFunctions: true,
|
||||
allowedNames: [],
|
||||
allowHigherOrderFunctions: true,
|
||||
allowTypedFunctionExpressions: true,
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
// tracks all of the functions we've already checked
|
||||
const checkedFunctions = new Set();
|
||||
const functionStack = [];
|
||||
const functionReturnsMap = new Map();
|
||||
// all nodes visited, avoids infinite recursion for cyclic references
|
||||
// (such as class member referring to itself)
|
||||
const alreadyVisited = new Set();
|
||||
function getReturnsInFunction(node) {
|
||||
return functionReturnsMap.get(node) ?? [];
|
||||
}
|
||||
function enterFunction(node) {
|
||||
functionStack.push(node);
|
||||
functionReturnsMap.set(node, []);
|
||||
}
|
||||
function exitFunction() {
|
||||
functionStack.pop();
|
||||
}
|
||||
/*
|
||||
# How the rule works:
|
||||
|
||||
As the rule traverses the AST, it immediately checks every single function that it finds is exported.
|
||||
"exported" means that it is either directly exported, or that its name is exported.
|
||||
|
||||
It also collects a list of every single function it finds on the way, but does not check them.
|
||||
After it's finished traversing the AST, it then iterates through the list of found functions, and checks to see if
|
||||
any of them are part of a higher-order function
|
||||
*/
|
||||
return {
|
||||
'ExportDefaultDeclaration:exit'(node) {
|
||||
checkNode(node.declaration);
|
||||
},
|
||||
'ExportNamedDeclaration:not([source]):exit'(node) {
|
||||
if (node.declaration) {
|
||||
checkNode(node.declaration);
|
||||
}
|
||||
else {
|
||||
for (const specifier of node.specifiers) {
|
||||
followReference(specifier.local);
|
||||
}
|
||||
}
|
||||
},
|
||||
'TSExportAssignment:exit'(node) {
|
||||
checkNode(node.expression);
|
||||
},
|
||||
'ArrowFunctionExpression, FunctionDeclaration, FunctionExpression': enterFunction,
|
||||
'ArrowFunctionExpression:exit': exitFunction,
|
||||
'FunctionDeclaration:exit': exitFunction,
|
||||
'FunctionExpression:exit': exitFunction,
|
||||
'Program:exit'() {
|
||||
for (const [node, returns] of functionReturnsMap) {
|
||||
if (isExportedHigherOrderFunction({ node, returns })) {
|
||||
checkNode(node);
|
||||
}
|
||||
}
|
||||
},
|
||||
ReturnStatement(node) {
|
||||
const current = functionStack[functionStack.length - 1];
|
||||
functionReturnsMap.get(current)?.push(node);
|
||||
},
|
||||
};
|
||||
function checkParameters(node) {
|
||||
function checkParameter(param) {
|
||||
function report(namedMessageId, unnamedMessageId) {
|
||||
if (param.type === utils_1.AST_NODE_TYPES.Identifier) {
|
||||
context.report({
|
||||
node: param,
|
||||
messageId: namedMessageId,
|
||||
data: { name: param.name },
|
||||
});
|
||||
}
|
||||
else if (param.type === utils_1.AST_NODE_TYPES.ArrayPattern) {
|
||||
context.report({
|
||||
node: param,
|
||||
messageId: unnamedMessageId,
|
||||
data: { type: 'Array pattern' },
|
||||
});
|
||||
}
|
||||
else if (param.type === utils_1.AST_NODE_TYPES.ObjectPattern) {
|
||||
context.report({
|
||||
node: param,
|
||||
messageId: unnamedMessageId,
|
||||
data: { type: 'Object pattern' },
|
||||
});
|
||||
}
|
||||
else if (param.type === utils_1.AST_NODE_TYPES.RestElement) {
|
||||
if (param.argument.type === utils_1.AST_NODE_TYPES.Identifier) {
|
||||
context.report({
|
||||
node: param,
|
||||
messageId: namedMessageId,
|
||||
data: { name: param.argument.name },
|
||||
});
|
||||
}
|
||||
else {
|
||||
context.report({
|
||||
node: param,
|
||||
messageId: unnamedMessageId,
|
||||
data: { type: 'Rest' },
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (param.type) {
|
||||
case utils_1.AST_NODE_TYPES.ArrayPattern:
|
||||
case utils_1.AST_NODE_TYPES.Identifier:
|
||||
case utils_1.AST_NODE_TYPES.ObjectPattern:
|
||||
case utils_1.AST_NODE_TYPES.RestElement:
|
||||
if (!param.typeAnnotation) {
|
||||
report('missingArgType', 'missingArgTypeUnnamed');
|
||||
}
|
||||
else if (options.allowArgumentsExplicitlyTypedAsAny !== true &&
|
||||
param.typeAnnotation.typeAnnotation.type ===
|
||||
utils_1.AST_NODE_TYPES.TSAnyKeyword) {
|
||||
report('anyTypedArg', 'anyTypedArgUnnamed');
|
||||
}
|
||||
return;
|
||||
case utils_1.AST_NODE_TYPES.TSParameterProperty:
|
||||
return checkParameter(param.parameter);
|
||||
case utils_1.AST_NODE_TYPES.AssignmentPattern: // ignored as it has a type via its assignment
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (const arg of node.params) {
|
||||
checkParameter(arg);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Checks if a function name is allowed and should not be checked.
|
||||
*/
|
||||
function isAllowedName(node) {
|
||||
if (!node || !options.allowedNames || options.allowedNames.length === 0) {
|
||||
return false;
|
||||
}
|
||||
if (node.type === utils_1.AST_NODE_TYPES.VariableDeclarator ||
|
||||
node.type === utils_1.AST_NODE_TYPES.FunctionDeclaration) {
|
||||
return (node.id?.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
options.allowedNames.includes(node.id.name));
|
||||
}
|
||||
else if (node.type === utils_1.AST_NODE_TYPES.MethodDefinition ||
|
||||
node.type === utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition ||
|
||||
(node.type === utils_1.AST_NODE_TYPES.Property && node.method) ||
|
||||
node.type === utils_1.AST_NODE_TYPES.PropertyDefinition) {
|
||||
if (node.key.type === utils_1.AST_NODE_TYPES.Literal &&
|
||||
typeof node.key.value === 'string') {
|
||||
return options.allowedNames.includes(node.key.value);
|
||||
}
|
||||
if (node.key.type === utils_1.AST_NODE_TYPES.TemplateLiteral &&
|
||||
node.key.expressions.length === 0) {
|
||||
return options.allowedNames.includes(node.key.quasis[0].value.raw);
|
||||
}
|
||||
if (!node.computed && node.key.type === utils_1.AST_NODE_TYPES.Identifier) {
|
||||
return options.allowedNames.includes(node.key.name);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isExportedHigherOrderFunction({ node, }) {
|
||||
let current = node.parent;
|
||||
while (current) {
|
||||
if (current.type === utils_1.AST_NODE_TYPES.ReturnStatement) {
|
||||
// the parent of a return will always be a block statement, so we can skip over it
|
||||
current = current.parent.parent;
|
||||
continue;
|
||||
}
|
||||
if (!(0, util_1.isFunction)(current)) {
|
||||
return false;
|
||||
}
|
||||
const returns = getReturnsInFunction(current);
|
||||
if (!(0, explicitReturnTypeUtils_1.doesImmediatelyReturnFunctionExpression)({ node: current, returns })) {
|
||||
return false;
|
||||
}
|
||||
if (checkedFunctions.has(current)) {
|
||||
return true;
|
||||
}
|
||||
current = current.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function followReference(node) {
|
||||
const scope = context.sourceCode.getScope(node);
|
||||
const variable = scope.set.get(node.name);
|
||||
/* istanbul ignore if */ if (!variable) {
|
||||
return;
|
||||
}
|
||||
// check all of the definitions
|
||||
for (const definition of variable.defs) {
|
||||
// cases we don't care about in this rule
|
||||
if ([
|
||||
scope_manager_1.DefinitionType.ImplicitGlobalVariable,
|
||||
scope_manager_1.DefinitionType.ImportBinding,
|
||||
scope_manager_1.DefinitionType.CatchClause,
|
||||
scope_manager_1.DefinitionType.Parameter,
|
||||
].includes(definition.type)) {
|
||||
continue;
|
||||
}
|
||||
checkNode(definition.node);
|
||||
}
|
||||
// follow references to find writes to the variable
|
||||
for (const reference of variable.references) {
|
||||
if (
|
||||
// we don't want to check the initialization ref, as this is handled by the declaration check
|
||||
!reference.init &&
|
||||
reference.writeExpr) {
|
||||
checkNode(reference.writeExpr);
|
||||
}
|
||||
}
|
||||
}
|
||||
function checkNode(node) {
|
||||
if (node == null || alreadyVisited.has(node)) {
|
||||
return;
|
||||
}
|
||||
alreadyVisited.add(node);
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.ArrowFunctionExpression:
|
||||
case utils_1.AST_NODE_TYPES.FunctionExpression: {
|
||||
const returns = getReturnsInFunction(node);
|
||||
return checkFunctionExpression({ node, returns });
|
||||
}
|
||||
case utils_1.AST_NODE_TYPES.ArrayExpression:
|
||||
for (const element of node.elements) {
|
||||
checkNode(element);
|
||||
}
|
||||
return;
|
||||
case utils_1.AST_NODE_TYPES.PropertyDefinition:
|
||||
if (node.accessibility === 'private' ||
|
||||
node.key.type === utils_1.AST_NODE_TYPES.PrivateIdentifier) {
|
||||
return;
|
||||
}
|
||||
return checkNode(node.value);
|
||||
case utils_1.AST_NODE_TYPES.ClassDeclaration:
|
||||
case utils_1.AST_NODE_TYPES.ClassExpression:
|
||||
for (const element of node.body.body) {
|
||||
checkNode(element);
|
||||
}
|
||||
return;
|
||||
case utils_1.AST_NODE_TYPES.FunctionDeclaration: {
|
||||
const returns = getReturnsInFunction(node);
|
||||
return checkFunction({ node, returns });
|
||||
}
|
||||
case utils_1.AST_NODE_TYPES.MethodDefinition:
|
||||
case utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition:
|
||||
if (node.accessibility === 'private' ||
|
||||
node.key.type === utils_1.AST_NODE_TYPES.PrivateIdentifier) {
|
||||
return;
|
||||
}
|
||||
return checkNode(node.value);
|
||||
case utils_1.AST_NODE_TYPES.Identifier:
|
||||
return followReference(node);
|
||||
case utils_1.AST_NODE_TYPES.ObjectExpression:
|
||||
for (const property of node.properties) {
|
||||
checkNode(property);
|
||||
}
|
||||
return;
|
||||
case utils_1.AST_NODE_TYPES.Property:
|
||||
return checkNode(node.value);
|
||||
case utils_1.AST_NODE_TYPES.TSEmptyBodyFunctionExpression:
|
||||
return checkEmptyBodyFunctionExpression(node);
|
||||
case utils_1.AST_NODE_TYPES.VariableDeclaration:
|
||||
for (const declaration of node.declarations) {
|
||||
checkNode(declaration);
|
||||
}
|
||||
return;
|
||||
case utils_1.AST_NODE_TYPES.VariableDeclarator:
|
||||
return checkNode(node.init);
|
||||
}
|
||||
}
|
||||
function checkEmptyBodyFunctionExpression(node) {
|
||||
const isConstructor = node.parent.type === utils_1.AST_NODE_TYPES.MethodDefinition &&
|
||||
node.parent.kind === 'constructor';
|
||||
const isSetAccessor = (node.parent.type === utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition ||
|
||||
node.parent.type === utils_1.AST_NODE_TYPES.MethodDefinition) &&
|
||||
node.parent.kind === 'set';
|
||||
if (!isConstructor && !isSetAccessor && !node.returnType) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'missingReturnType',
|
||||
});
|
||||
}
|
||||
checkParameters(node);
|
||||
}
|
||||
function checkFunctionExpression({ node, returns, }) {
|
||||
if (checkedFunctions.has(node)) {
|
||||
return;
|
||||
}
|
||||
checkedFunctions.add(node);
|
||||
if (isAllowedName(node.parent) ||
|
||||
(0, explicitReturnTypeUtils_1.isTypedFunctionExpression)(node, options) ||
|
||||
(0, explicitReturnTypeUtils_1.ancestorHasReturnType)(node)) {
|
||||
return;
|
||||
}
|
||||
(0, explicitReturnTypeUtils_1.checkFunctionExpressionReturnType)({ node, returns }, options, context.sourceCode, loc => {
|
||||
context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId: 'missingReturnType',
|
||||
});
|
||||
});
|
||||
checkParameters(node);
|
||||
}
|
||||
function checkFunction({ node, returns, }) {
|
||||
if (checkedFunctions.has(node)) {
|
||||
return;
|
||||
}
|
||||
checkedFunctions.add(node);
|
||||
if (isAllowedName(node) || (0, explicitReturnTypeUtils_1.ancestorHasReturnType)(node)) {
|
||||
return;
|
||||
}
|
||||
(0, explicitReturnTypeUtils_1.checkFunctionReturnType)({ node, returns }, options, context.sourceCode, loc => {
|
||||
context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId: 'missingReturnType',
|
||||
});
|
||||
});
|
||||
checkParameters(node);
|
||||
}
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=explicit-module-boundary-types.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-module-boundary-types.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-module-boundary-types.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
260
node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js
generated
vendored
Normal file
260
node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js
generated
vendored
Normal file
@@ -0,0 +1,260 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const adjacent_overload_signatures_1 = __importDefault(require("./adjacent-overload-signatures"));
|
||||
const array_type_1 = __importDefault(require("./array-type"));
|
||||
const await_thenable_1 = __importDefault(require("./await-thenable"));
|
||||
const ban_ts_comment_1 = __importDefault(require("./ban-ts-comment"));
|
||||
const ban_tslint_comment_1 = __importDefault(require("./ban-tslint-comment"));
|
||||
const class_literal_property_style_1 = __importDefault(require("./class-literal-property-style"));
|
||||
const class_methods_use_this_1 = __importDefault(require("./class-methods-use-this"));
|
||||
const consistent_generic_constructors_1 = __importDefault(require("./consistent-generic-constructors"));
|
||||
const consistent_indexed_object_style_1 = __importDefault(require("./consistent-indexed-object-style"));
|
||||
const consistent_return_1 = __importDefault(require("./consistent-return"));
|
||||
const consistent_type_assertions_1 = __importDefault(require("./consistent-type-assertions"));
|
||||
const consistent_type_definitions_1 = __importDefault(require("./consistent-type-definitions"));
|
||||
const consistent_type_exports_1 = __importDefault(require("./consistent-type-exports"));
|
||||
const consistent_type_imports_1 = __importDefault(require("./consistent-type-imports"));
|
||||
const default_param_last_1 = __importDefault(require("./default-param-last"));
|
||||
const dot_notation_1 = __importDefault(require("./dot-notation"));
|
||||
const explicit_function_return_type_1 = __importDefault(require("./explicit-function-return-type"));
|
||||
const explicit_member_accessibility_1 = __importDefault(require("./explicit-member-accessibility"));
|
||||
const explicit_module_boundary_types_1 = __importDefault(require("./explicit-module-boundary-types"));
|
||||
const init_declarations_1 = __importDefault(require("./init-declarations"));
|
||||
const max_params_1 = __importDefault(require("./max-params"));
|
||||
const member_ordering_1 = __importDefault(require("./member-ordering"));
|
||||
const method_signature_style_1 = __importDefault(require("./method-signature-style"));
|
||||
const naming_convention_1 = __importDefault(require("./naming-convention"));
|
||||
const no_array_constructor_1 = __importDefault(require("./no-array-constructor"));
|
||||
const no_array_delete_1 = __importDefault(require("./no-array-delete"));
|
||||
const no_base_to_string_1 = __importDefault(require("./no-base-to-string"));
|
||||
const no_confusing_non_null_assertion_1 = __importDefault(require("./no-confusing-non-null-assertion"));
|
||||
const no_confusing_void_expression_1 = __importDefault(require("./no-confusing-void-expression"));
|
||||
const no_dupe_class_members_1 = __importDefault(require("./no-dupe-class-members"));
|
||||
const no_duplicate_enum_values_1 = __importDefault(require("./no-duplicate-enum-values"));
|
||||
const no_duplicate_type_constituents_1 = __importDefault(require("./no-duplicate-type-constituents"));
|
||||
const no_dynamic_delete_1 = __importDefault(require("./no-dynamic-delete"));
|
||||
const no_empty_function_1 = __importDefault(require("./no-empty-function"));
|
||||
const no_empty_interface_1 = __importDefault(require("./no-empty-interface"));
|
||||
const no_empty_object_type_1 = __importDefault(require("./no-empty-object-type"));
|
||||
const no_explicit_any_1 = __importDefault(require("./no-explicit-any"));
|
||||
const no_extra_non_null_assertion_1 = __importDefault(require("./no-extra-non-null-assertion"));
|
||||
const no_extraneous_class_1 = __importDefault(require("./no-extraneous-class"));
|
||||
const no_floating_promises_1 = __importDefault(require("./no-floating-promises"));
|
||||
const no_for_in_array_1 = __importDefault(require("./no-for-in-array"));
|
||||
const no_implied_eval_1 = __importDefault(require("./no-implied-eval"));
|
||||
const no_import_type_side_effects_1 = __importDefault(require("./no-import-type-side-effects"));
|
||||
const no_inferrable_types_1 = __importDefault(require("./no-inferrable-types"));
|
||||
const no_invalid_this_1 = __importDefault(require("./no-invalid-this"));
|
||||
const no_invalid_void_type_1 = __importDefault(require("./no-invalid-void-type"));
|
||||
const no_loop_func_1 = __importDefault(require("./no-loop-func"));
|
||||
const no_loss_of_precision_1 = __importDefault(require("./no-loss-of-precision"));
|
||||
const no_magic_numbers_1 = __importDefault(require("./no-magic-numbers"));
|
||||
const no_meaningless_void_operator_1 = __importDefault(require("./no-meaningless-void-operator"));
|
||||
const no_misused_new_1 = __importDefault(require("./no-misused-new"));
|
||||
const no_misused_promises_1 = __importDefault(require("./no-misused-promises"));
|
||||
const no_mixed_enums_1 = __importDefault(require("./no-mixed-enums"));
|
||||
const no_namespace_1 = __importDefault(require("./no-namespace"));
|
||||
const no_non_null_asserted_nullish_coalescing_1 = __importDefault(require("./no-non-null-asserted-nullish-coalescing"));
|
||||
const no_non_null_asserted_optional_chain_1 = __importDefault(require("./no-non-null-asserted-optional-chain"));
|
||||
const no_non_null_assertion_1 = __importDefault(require("./no-non-null-assertion"));
|
||||
const no_redeclare_1 = __importDefault(require("./no-redeclare"));
|
||||
const no_redundant_type_constituents_1 = __importDefault(require("./no-redundant-type-constituents"));
|
||||
const no_require_imports_1 = __importDefault(require("./no-require-imports"));
|
||||
const no_restricted_imports_1 = __importDefault(require("./no-restricted-imports"));
|
||||
const no_restricted_types_1 = __importDefault(require("./no-restricted-types"));
|
||||
const no_shadow_1 = __importDefault(require("./no-shadow"));
|
||||
const no_this_alias_1 = __importDefault(require("./no-this-alias"));
|
||||
const no_type_alias_1 = __importDefault(require("./no-type-alias"));
|
||||
const no_unnecessary_boolean_literal_compare_1 = __importDefault(require("./no-unnecessary-boolean-literal-compare"));
|
||||
const no_unnecessary_condition_1 = __importDefault(require("./no-unnecessary-condition"));
|
||||
const no_unnecessary_parameter_property_assignment_1 = __importDefault(require("./no-unnecessary-parameter-property-assignment"));
|
||||
const no_unnecessary_qualifier_1 = __importDefault(require("./no-unnecessary-qualifier"));
|
||||
const no_unnecessary_template_expression_1 = __importDefault(require("./no-unnecessary-template-expression"));
|
||||
const no_unnecessary_type_arguments_1 = __importDefault(require("./no-unnecessary-type-arguments"));
|
||||
const no_unnecessary_type_assertion_1 = __importDefault(require("./no-unnecessary-type-assertion"));
|
||||
const no_unnecessary_type_constraint_1 = __importDefault(require("./no-unnecessary-type-constraint"));
|
||||
const no_unnecessary_type_parameters_1 = __importDefault(require("./no-unnecessary-type-parameters"));
|
||||
const no_unsafe_argument_1 = __importDefault(require("./no-unsafe-argument"));
|
||||
const no_unsafe_assignment_1 = __importDefault(require("./no-unsafe-assignment"));
|
||||
const no_unsafe_call_1 = __importDefault(require("./no-unsafe-call"));
|
||||
const no_unsafe_declaration_merging_1 = __importDefault(require("./no-unsafe-declaration-merging"));
|
||||
const no_unsafe_enum_comparison_1 = __importDefault(require("./no-unsafe-enum-comparison"));
|
||||
const no_unsafe_function_type_1 = __importDefault(require("./no-unsafe-function-type"));
|
||||
const no_unsafe_member_access_1 = __importDefault(require("./no-unsafe-member-access"));
|
||||
const no_unsafe_return_1 = __importDefault(require("./no-unsafe-return"));
|
||||
const no_unsafe_unary_minus_1 = __importDefault(require("./no-unsafe-unary-minus"));
|
||||
const no_unused_expressions_1 = __importDefault(require("./no-unused-expressions"));
|
||||
const no_unused_vars_1 = __importDefault(require("./no-unused-vars"));
|
||||
const no_use_before_define_1 = __importDefault(require("./no-use-before-define"));
|
||||
const no_useless_constructor_1 = __importDefault(require("./no-useless-constructor"));
|
||||
const no_useless_empty_export_1 = __importDefault(require("./no-useless-empty-export"));
|
||||
const no_var_requires_1 = __importDefault(require("./no-var-requires"));
|
||||
const no_wrapper_object_types_1 = __importDefault(require("./no-wrapper-object-types"));
|
||||
const non_nullable_type_assertion_style_1 = __importDefault(require("./non-nullable-type-assertion-style"));
|
||||
const only_throw_error_1 = __importDefault(require("./only-throw-error"));
|
||||
const parameter_properties_1 = __importDefault(require("./parameter-properties"));
|
||||
const prefer_as_const_1 = __importDefault(require("./prefer-as-const"));
|
||||
const prefer_destructuring_1 = __importDefault(require("./prefer-destructuring"));
|
||||
const prefer_enum_initializers_1 = __importDefault(require("./prefer-enum-initializers"));
|
||||
const prefer_find_1 = __importDefault(require("./prefer-find"));
|
||||
const prefer_for_of_1 = __importDefault(require("./prefer-for-of"));
|
||||
const prefer_function_type_1 = __importDefault(require("./prefer-function-type"));
|
||||
const prefer_includes_1 = __importDefault(require("./prefer-includes"));
|
||||
const prefer_literal_enum_member_1 = __importDefault(require("./prefer-literal-enum-member"));
|
||||
const prefer_namespace_keyword_1 = __importDefault(require("./prefer-namespace-keyword"));
|
||||
const prefer_nullish_coalescing_1 = __importDefault(require("./prefer-nullish-coalescing"));
|
||||
const prefer_optional_chain_1 = __importDefault(require("./prefer-optional-chain"));
|
||||
const prefer_promise_reject_errors_1 = __importDefault(require("./prefer-promise-reject-errors"));
|
||||
const prefer_readonly_1 = __importDefault(require("./prefer-readonly"));
|
||||
const prefer_readonly_parameter_types_1 = __importDefault(require("./prefer-readonly-parameter-types"));
|
||||
const prefer_reduce_type_parameter_1 = __importDefault(require("./prefer-reduce-type-parameter"));
|
||||
const prefer_regexp_exec_1 = __importDefault(require("./prefer-regexp-exec"));
|
||||
const prefer_return_this_type_1 = __importDefault(require("./prefer-return-this-type"));
|
||||
const prefer_string_starts_ends_with_1 = __importDefault(require("./prefer-string-starts-ends-with"));
|
||||
const prefer_ts_expect_error_1 = __importDefault(require("./prefer-ts-expect-error"));
|
||||
const promise_function_async_1 = __importDefault(require("./promise-function-async"));
|
||||
const require_array_sort_compare_1 = __importDefault(require("./require-array-sort-compare"));
|
||||
const require_await_1 = __importDefault(require("./require-await"));
|
||||
const restrict_plus_operands_1 = __importDefault(require("./restrict-plus-operands"));
|
||||
const restrict_template_expressions_1 = __importDefault(require("./restrict-template-expressions"));
|
||||
const return_await_1 = __importDefault(require("./return-await"));
|
||||
const sort_type_constituents_1 = __importDefault(require("./sort-type-constituents"));
|
||||
const strict_boolean_expressions_1 = __importDefault(require("./strict-boolean-expressions"));
|
||||
const switch_exhaustiveness_check_1 = __importDefault(require("./switch-exhaustiveness-check"));
|
||||
const triple_slash_reference_1 = __importDefault(require("./triple-slash-reference"));
|
||||
const typedef_1 = __importDefault(require("./typedef"));
|
||||
const unbound_method_1 = __importDefault(require("./unbound-method"));
|
||||
const unified_signatures_1 = __importDefault(require("./unified-signatures"));
|
||||
const use_unknown_in_catch_callback_variable_1 = __importDefault(require("./use-unknown-in-catch-callback-variable"));
|
||||
exports.default = {
|
||||
'adjacent-overload-signatures': adjacent_overload_signatures_1.default,
|
||||
'array-type': array_type_1.default,
|
||||
'await-thenable': await_thenable_1.default,
|
||||
'ban-ts-comment': ban_ts_comment_1.default,
|
||||
'ban-tslint-comment': ban_tslint_comment_1.default,
|
||||
'class-literal-property-style': class_literal_property_style_1.default,
|
||||
'class-methods-use-this': class_methods_use_this_1.default,
|
||||
'consistent-generic-constructors': consistent_generic_constructors_1.default,
|
||||
'consistent-indexed-object-style': consistent_indexed_object_style_1.default,
|
||||
'consistent-return': consistent_return_1.default,
|
||||
'consistent-type-assertions': consistent_type_assertions_1.default,
|
||||
'consistent-type-definitions': consistent_type_definitions_1.default,
|
||||
'consistent-type-exports': consistent_type_exports_1.default,
|
||||
'consistent-type-imports': consistent_type_imports_1.default,
|
||||
'default-param-last': default_param_last_1.default,
|
||||
'dot-notation': dot_notation_1.default,
|
||||
'explicit-function-return-type': explicit_function_return_type_1.default,
|
||||
'explicit-member-accessibility': explicit_member_accessibility_1.default,
|
||||
'explicit-module-boundary-types': explicit_module_boundary_types_1.default,
|
||||
'init-declarations': init_declarations_1.default,
|
||||
'max-params': max_params_1.default,
|
||||
'member-ordering': member_ordering_1.default,
|
||||
'method-signature-style': method_signature_style_1.default,
|
||||
'naming-convention': naming_convention_1.default,
|
||||
'no-array-constructor': no_array_constructor_1.default,
|
||||
'no-array-delete': no_array_delete_1.default,
|
||||
'no-base-to-string': no_base_to_string_1.default,
|
||||
'no-confusing-non-null-assertion': no_confusing_non_null_assertion_1.default,
|
||||
'no-confusing-void-expression': no_confusing_void_expression_1.default,
|
||||
'no-dupe-class-members': no_dupe_class_members_1.default,
|
||||
'no-duplicate-enum-values': no_duplicate_enum_values_1.default,
|
||||
'no-duplicate-type-constituents': no_duplicate_type_constituents_1.default,
|
||||
'no-dynamic-delete': no_dynamic_delete_1.default,
|
||||
'no-empty-function': no_empty_function_1.default,
|
||||
'no-empty-interface': no_empty_interface_1.default,
|
||||
'no-empty-object-type': no_empty_object_type_1.default,
|
||||
'no-explicit-any': no_explicit_any_1.default,
|
||||
'no-extra-non-null-assertion': no_extra_non_null_assertion_1.default,
|
||||
'no-extraneous-class': no_extraneous_class_1.default,
|
||||
'no-floating-promises': no_floating_promises_1.default,
|
||||
'no-for-in-array': no_for_in_array_1.default,
|
||||
'no-implied-eval': no_implied_eval_1.default,
|
||||
'no-import-type-side-effects': no_import_type_side_effects_1.default,
|
||||
'no-inferrable-types': no_inferrable_types_1.default,
|
||||
'no-invalid-this': no_invalid_this_1.default,
|
||||
'no-invalid-void-type': no_invalid_void_type_1.default,
|
||||
'no-loop-func': no_loop_func_1.default,
|
||||
'no-loss-of-precision': no_loss_of_precision_1.default,
|
||||
'no-magic-numbers': no_magic_numbers_1.default,
|
||||
'no-meaningless-void-operator': no_meaningless_void_operator_1.default,
|
||||
'no-misused-new': no_misused_new_1.default,
|
||||
'no-misused-promises': no_misused_promises_1.default,
|
||||
'no-mixed-enums': no_mixed_enums_1.default,
|
||||
'no-namespace': no_namespace_1.default,
|
||||
'no-non-null-asserted-nullish-coalescing': no_non_null_asserted_nullish_coalescing_1.default,
|
||||
'no-non-null-asserted-optional-chain': no_non_null_asserted_optional_chain_1.default,
|
||||
'no-non-null-assertion': no_non_null_assertion_1.default,
|
||||
'no-redeclare': no_redeclare_1.default,
|
||||
'no-redundant-type-constituents': no_redundant_type_constituents_1.default,
|
||||
'no-require-imports': no_require_imports_1.default,
|
||||
'no-restricted-imports': no_restricted_imports_1.default,
|
||||
'no-restricted-types': no_restricted_types_1.default,
|
||||
'no-shadow': no_shadow_1.default,
|
||||
'no-this-alias': no_this_alias_1.default,
|
||||
'no-type-alias': no_type_alias_1.default,
|
||||
'no-unnecessary-boolean-literal-compare': no_unnecessary_boolean_literal_compare_1.default,
|
||||
'no-unnecessary-condition': no_unnecessary_condition_1.default,
|
||||
'no-unnecessary-parameter-property-assignment': no_unnecessary_parameter_property_assignment_1.default,
|
||||
'no-unnecessary-qualifier': no_unnecessary_qualifier_1.default,
|
||||
'no-unnecessary-template-expression': no_unnecessary_template_expression_1.default,
|
||||
'no-unnecessary-type-arguments': no_unnecessary_type_arguments_1.default,
|
||||
'no-unnecessary-type-assertion': no_unnecessary_type_assertion_1.default,
|
||||
'no-unnecessary-type-constraint': no_unnecessary_type_constraint_1.default,
|
||||
'no-unnecessary-type-parameters': no_unnecessary_type_parameters_1.default,
|
||||
'no-unsafe-argument': no_unsafe_argument_1.default,
|
||||
'no-unsafe-assignment': no_unsafe_assignment_1.default,
|
||||
'no-unsafe-call': no_unsafe_call_1.default,
|
||||
'no-unsafe-declaration-merging': no_unsafe_declaration_merging_1.default,
|
||||
'no-unsafe-enum-comparison': no_unsafe_enum_comparison_1.default,
|
||||
'no-unsafe-function-type': no_unsafe_function_type_1.default,
|
||||
'no-unsafe-member-access': no_unsafe_member_access_1.default,
|
||||
'no-unsafe-return': no_unsafe_return_1.default,
|
||||
'no-unsafe-unary-minus': no_unsafe_unary_minus_1.default,
|
||||
'no-unused-expressions': no_unused_expressions_1.default,
|
||||
'no-unused-vars': no_unused_vars_1.default,
|
||||
'no-use-before-define': no_use_before_define_1.default,
|
||||
'no-useless-constructor': no_useless_constructor_1.default,
|
||||
'no-useless-empty-export': no_useless_empty_export_1.default,
|
||||
'no-var-requires': no_var_requires_1.default,
|
||||
'no-wrapper-object-types': no_wrapper_object_types_1.default,
|
||||
'non-nullable-type-assertion-style': non_nullable_type_assertion_style_1.default,
|
||||
'only-throw-error': only_throw_error_1.default,
|
||||
'parameter-properties': parameter_properties_1.default,
|
||||
'prefer-as-const': prefer_as_const_1.default,
|
||||
'prefer-destructuring': prefer_destructuring_1.default,
|
||||
'prefer-enum-initializers': prefer_enum_initializers_1.default,
|
||||
'prefer-find': prefer_find_1.default,
|
||||
'prefer-for-of': prefer_for_of_1.default,
|
||||
'prefer-function-type': prefer_function_type_1.default,
|
||||
'prefer-includes': prefer_includes_1.default,
|
||||
'prefer-literal-enum-member': prefer_literal_enum_member_1.default,
|
||||
'prefer-namespace-keyword': prefer_namespace_keyword_1.default,
|
||||
'prefer-nullish-coalescing': prefer_nullish_coalescing_1.default,
|
||||
'prefer-optional-chain': prefer_optional_chain_1.default,
|
||||
'prefer-promise-reject-errors': prefer_promise_reject_errors_1.default,
|
||||
'prefer-readonly': prefer_readonly_1.default,
|
||||
'prefer-readonly-parameter-types': prefer_readonly_parameter_types_1.default,
|
||||
'prefer-reduce-type-parameter': prefer_reduce_type_parameter_1.default,
|
||||
'prefer-regexp-exec': prefer_regexp_exec_1.default,
|
||||
'prefer-return-this-type': prefer_return_this_type_1.default,
|
||||
'prefer-string-starts-ends-with': prefer_string_starts_ends_with_1.default,
|
||||
'prefer-ts-expect-error': prefer_ts_expect_error_1.default,
|
||||
'promise-function-async': promise_function_async_1.default,
|
||||
'require-array-sort-compare': require_array_sort_compare_1.default,
|
||||
'require-await': require_await_1.default,
|
||||
'restrict-plus-operands': restrict_plus_operands_1.default,
|
||||
'restrict-template-expressions': restrict_template_expressions_1.default,
|
||||
'return-await': return_await_1.default,
|
||||
'sort-type-constituents': sort_type_constituents_1.default,
|
||||
'strict-boolean-expressions': strict_boolean_expressions_1.default,
|
||||
'switch-exhaustiveness-check': switch_exhaustiveness_check_1.default,
|
||||
'triple-slash-reference': triple_slash_reference_1.default,
|
||||
typedef: typedef_1.default,
|
||||
'unbound-method': unbound_method_1.default,
|
||||
'unified-signatures': unified_signatures_1.default,
|
||||
'use-unknown-in-catch-callback-variable': use_unknown_in_catch_callback_variable_1.default,
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":";;;;;AAEA,kGAAwE;AACxE,8DAAqC;AACrC,sEAA6C;AAC7C,sEAA4C;AAC5C,8EAAoD;AACpD,kGAAuE;AACvE,sFAA2D;AAC3D,wGAA8E;AAC9E,wGAA6E;AAC7E,4EAAmD;AACnD,8FAAoE;AACpE,gGAAsE;AACtE,wFAA8D;AAC9D,wFAA8D;AAC9D,8EAAoD;AACpD,kEAAyC;AACzC,oGAAyE;AACzE,oGAA0E;AAC1E,sGAA2E;AAC3E,4EAAmD;AACnD,8DAAqC;AACrC,wEAA+C;AAC/C,sFAA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A2B;IAC5D,cAAc,EAAE,sBAAW;IAC3B,wBAAwB,EAAE,gCAAoB;IAC9C,4BAA4B,EAAE,oCAAwB;IACtD,6BAA6B,EAAE,qCAAyB;IACxD,wBAAwB,EAAE,gCAAoB;IAC9C,OAAO,EAAE,iBAAO;IAChB,gBAAgB,EAAE,wBAAa;IAC/B,oBAAoB,EAAE,4BAAiB;IACvC,wCAAwC,EAAE,gDAAiC;CAC/C,CAAC"}
|
||||
104
node_modules/@typescript-eslint/eslint-plugin/dist/rules/init-declarations.js
generated
vendored
Normal file
104
node_modules/@typescript-eslint/eslint-plugin/dist/rules/init-declarations.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
|
||||
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('init-declarations');
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'init-declarations',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Require or disallow initialization in variable declarations',
|
||||
extendsBaseRule: true,
|
||||
},
|
||||
hasSuggestions: baseRule.meta.hasSuggestions,
|
||||
schema: baseRule.meta.schema,
|
||||
messages: baseRule.meta.messages,
|
||||
},
|
||||
defaultOptions: ['always'],
|
||||
create(context, [mode]) {
|
||||
// Make a custom context to adjust the the loc of reports where the base
|
||||
// rule's behavior is a bit too aggressive with TS-specific syntax (namely,
|
||||
// type annotations).
|
||||
function getBaseContextOverride() {
|
||||
const reportOverride = descriptor => {
|
||||
if ('node' in descriptor && descriptor.loc == null) {
|
||||
const { node, ...rest } = descriptor;
|
||||
// We only want to special case the report loc when reporting on
|
||||
// variables declarations that are not initialized. Declarations that
|
||||
// _are_ initialized get reported by the base rule due to a setting to
|
||||
// prohibit initializing variables entirely, in which case underlining
|
||||
// the whole node including the type annotation and initializer is
|
||||
// appropriate.
|
||||
if (node.type === utils_1.AST_NODE_TYPES.VariableDeclarator &&
|
||||
node.init == null) {
|
||||
context.report({
|
||||
...rest,
|
||||
loc: getReportLoc(node),
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
context.report(descriptor);
|
||||
};
|
||||
// `return { ...context, report: reportOverride }` isn't safe because the
|
||||
// `context` object has some getters that need to be preserved.
|
||||
//
|
||||
// `return new Proxy(context, ...)` doesn't work because `context` has
|
||||
// non-configurable properties that throw when constructing a Proxy.
|
||||
//
|
||||
// So, we'll just use Proxy on a dummy object and use the `get` trap to
|
||||
// proxy `context`'s properties.
|
||||
return new Proxy({}, {
|
||||
get: (target, prop, receiver) => prop === 'report'
|
||||
? reportOverride
|
||||
: Reflect.get(context, prop, receiver),
|
||||
});
|
||||
}
|
||||
const rules = baseRule.create(getBaseContextOverride());
|
||||
return {
|
||||
'VariableDeclaration:exit'(node) {
|
||||
if (mode === 'always') {
|
||||
if (node.declare) {
|
||||
return;
|
||||
}
|
||||
if (isAncestorNamespaceDeclared(node)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
rules['VariableDeclaration:exit'](node);
|
||||
},
|
||||
};
|
||||
function isAncestorNamespaceDeclared(node) {
|
||||
let ancestor = node.parent;
|
||||
while (ancestor) {
|
||||
if (ancestor.type === utils_1.AST_NODE_TYPES.TSModuleDeclaration &&
|
||||
ancestor.declare) {
|
||||
return true;
|
||||
}
|
||||
ancestor = ancestor.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
});
|
||||
/**
|
||||
* When reporting an uninitialized variable declarator, get the loc excluding
|
||||
* the type annotation.
|
||||
*/
|
||||
function getReportLoc(node) {
|
||||
const start = structuredClone(node.loc.start);
|
||||
const end = {
|
||||
line: node.loc.start.line,
|
||||
// `if (id.type === AST_NODE_TYPES.Identifier)` is a condition for
|
||||
// reporting in the base rule (as opposed to things like destructuring
|
||||
// assignment), so the type assertion should always be valid.
|
||||
column: node.loc.start.column + node.id.name.length,
|
||||
};
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=init-declarations.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/init-declarations.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/init-declarations.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"init-declarations.js","sourceRoot":"","sources":["../../src/rules/init-declarations.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAM1D,kCAAqC;AACrC,iEAA8D;AAE9D,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC,mBAAmB,CAAC,CAAC;AAKxD,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EACT,6DAA6D;YAC/D,eAAe,EAAE,IAAI;SACtB;QACD,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,cAAc;QAC5C,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;QAC5B,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ;KACjC;IACD,cAAc,EAAE,CAAC,QAAQ,CAAC;IAC1B,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;QACpB,wEAAwE;QACxE,2EAA2E;QAC3E,qBAAqB;QACrB,SAAS,sBAAsB;YAC7B,MAAM,cAAc,GAA0B,UAAU,CAAC,EAAE;gBACzD,IAAI,MAAM,IAAI,UAAU,IAAI,UAAU,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC;oBACnD,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,UAAU,CAAC;oBACrC,gEAAgE;oBAChE,qEAAqE;oBACrE,sEAAsE;oBACtE,sEAAsE;oBACtE,kEAAkE;oBAClE,eAAe;oBACf,IACE,IAAI,C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,sBAAc,CAAC,mBAAmB;oBACpD,QAAQ,CAAC,OAAO,EAChB,CAAC;oBACD,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC;YAC7B,CAAC;YAED,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAS,YAAY,CACnB,IAAiC;IAEjC,MAAM,KAAK,GAAsB,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACjE,MAAM,GAAG,GAAsB;QAC7B,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI;QACzB,kEAAkE;QAClE,sEAAsE;QACtE,6DAA6D;QAC7D,MAAM,EACJ,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,GAAI,IAAI,CAAC,EAA0B,CAAC,IAAI,CAAC,MAAM;KACvE,CAAC;IAEF,OAAO;QACL,KAAK;QACL,GAAG;KACJ,CAAC;AACJ,CAAC"}
|
||||
67
node_modules/@typescript-eslint/eslint-plugin/dist/rules/max-params.js
generated
vendored
Normal file
67
node_modules/@typescript-eslint/eslint-plugin/dist/rules/max-params.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
|
||||
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('max-params');
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'max-params',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce a maximum number of parameters in function definitions',
|
||||
extendsBaseRule: true,
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
maximum: {
|
||||
type: 'integer',
|
||||
minimum: 0,
|
||||
},
|
||||
max: {
|
||||
type: 'integer',
|
||||
minimum: 0,
|
||||
},
|
||||
countVoidThis: {
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
messages: baseRule.meta.messages,
|
||||
},
|
||||
defaultOptions: [{ max: 3, countVoidThis: false }],
|
||||
create(context, [{ countVoidThis }]) {
|
||||
const baseRules = baseRule.create(context);
|
||||
if (countVoidThis === true) {
|
||||
return baseRules;
|
||||
}
|
||||
const removeVoidThisParam = (node) => {
|
||||
if (node.params.length === 0 ||
|
||||
node.params[0].type !== utils_1.AST_NODE_TYPES.Identifier ||
|
||||
node.params[0].name !== 'this' ||
|
||||
node.params[0].typeAnnotation?.typeAnnotation.type !==
|
||||
utils_1.AST_NODE_TYPES.TSVoidKeyword) {
|
||||
return node;
|
||||
}
|
||||
return {
|
||||
...node,
|
||||
params: node.params.slice(1),
|
||||
};
|
||||
};
|
||||
const wrapListener = (listener) => {
|
||||
return (node) => {
|
||||
listener(removeVoidThisParam(node));
|
||||
};
|
||||
};
|
||||
return {
|
||||
ArrowFunctionExpression: wrapListener(baseRules.ArrowFunctionExpression),
|
||||
FunctionDeclaration: wrapListener(baseRules.FunctionDeclaration),
|
||||
FunctionExpression: wrapListener(baseRules.FunctionExpression),
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=max-params.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/max-params.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/max-params.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"max-params.js","sourceRoot":"","sources":["../../src/rules/max-params.ts"],"names":[],"mappings":";;AACA,oDAA0D;AAM1D,kCAAqC;AACrC,iEAA8D;AAS9D,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC,YAAY,CAAC,CAAC;AAKjD,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,I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AAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;aAC7B,CAAC;QACJ,CAAC,CAAC;QAEF,MAAM,YAAY,GAAG,CACnB,QAAiC,EACR,EAAE;YAC3B,OAAO,CAAC,IAAO,EAAQ,EAAE;gBACvB,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC;YACtC,CAAC,CAAC;QACJ,CAAC,CAAC;QAEF,OAAO;YACL,uBAAuB,EAAE,YAAY,CAAC,SAAS,CAAC,uBAAuB,CAAC;YACxE,mBAAmB,EAAE,YAAY,CAAC,SAAS,CAAC,mBAAmB,CAAC;YAChE,kBAAkB,EAAE,YAAY,CAAC,SAAS,CAAC,kBAAkB,CAAC;SAC/D,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
822
node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js
generated
vendored
Normal file
822
node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js
generated
vendored
Normal file
@@ -0,0 +1,822 @@
|
||||
"use strict";
|
||||
// This rule was feature-frozen before we enabled no-property-in-node.
|
||||
/* eslint-disable eslint-plugin/no-property-in-node */
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.defaultOrder = void 0;
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const natural_compare_1 = __importDefault(require("natural-compare"));
|
||||
const util_1 = require("../util");
|
||||
const neverConfig = {
|
||||
type: 'string',
|
||||
enum: ['never'],
|
||||
};
|
||||
const arrayConfig = (memberTypes) => ({
|
||||
type: 'array',
|
||||
items: {
|
||||
oneOf: [
|
||||
{
|
||||
$ref: memberTypes,
|
||||
},
|
||||
{
|
||||
type: 'array',
|
||||
items: {
|
||||
$ref: memberTypes,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
const objectConfig = (memberTypes) => ({
|
||||
type: 'object',
|
||||
properties: {
|
||||
memberTypes: {
|
||||
oneOf: [arrayConfig(memberTypes), neverConfig],
|
||||
},
|
||||
order: {
|
||||
$ref: '#/items/0/$defs/orderOptions',
|
||||
},
|
||||
optionalityOrder: {
|
||||
$ref: '#/items/0/$defs/optionalityOrderOptions',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
});
|
||||
exports.defaultOrder = [
|
||||
// Index signature
|
||||
'signature',
|
||||
'call-signature',
|
||||
// Fields
|
||||
'public-static-field',
|
||||
'protected-static-field',
|
||||
'private-static-field',
|
||||
'#private-static-field',
|
||||
'public-decorated-field',
|
||||
'protected-decorated-field',
|
||||
'private-decorated-field',
|
||||
'public-instance-field',
|
||||
'protected-instance-field',
|
||||
'private-instance-field',
|
||||
'#private-instance-field',
|
||||
'public-abstract-field',
|
||||
'protected-abstract-field',
|
||||
'public-field',
|
||||
'protected-field',
|
||||
'private-field',
|
||||
'#private-field',
|
||||
'static-field',
|
||||
'instance-field',
|
||||
'abstract-field',
|
||||
'decorated-field',
|
||||
'field',
|
||||
// Static initialization
|
||||
'static-initialization',
|
||||
// Constructors
|
||||
'public-constructor',
|
||||
'protected-constructor',
|
||||
'private-constructor',
|
||||
'constructor',
|
||||
// Accessors
|
||||
'public-static-accessor',
|
||||
'protected-static-accessor',
|
||||
'private-static-accessor',
|
||||
'#private-static-accessor',
|
||||
'public-decorated-accessor',
|
||||
'protected-decorated-accessor',
|
||||
'private-decorated-accessor',
|
||||
'public-instance-accessor',
|
||||
'protected-instance-accessor',
|
||||
'private-instance-accessor',
|
||||
'#private-instance-accessor',
|
||||
'public-abstract-accessor',
|
||||
'protected-abstract-accessor',
|
||||
'public-accessor',
|
||||
'protected-accessor',
|
||||
'private-accessor',
|
||||
'#private-accessor',
|
||||
'static-accessor',
|
||||
'instance-accessor',
|
||||
'abstract-accessor',
|
||||
'decorated-accessor',
|
||||
'accessor',
|
||||
// Getters
|
||||
'public-static-get',
|
||||
'protected-static-get',
|
||||
'private-static-get',
|
||||
'#private-static-get',
|
||||
'public-decorated-get',
|
||||
'protected-decorated-get',
|
||||
'private-decorated-get',
|
||||
'public-instance-get',
|
||||
'protected-instance-get',
|
||||
'private-instance-get',
|
||||
'#private-instance-get',
|
||||
'public-abstract-get',
|
||||
'protected-abstract-get',
|
||||
'public-get',
|
||||
'protected-get',
|
||||
'private-get',
|
||||
'#private-get',
|
||||
'static-get',
|
||||
'instance-get',
|
||||
'abstract-get',
|
||||
'decorated-get',
|
||||
'get',
|
||||
// Setters
|
||||
'public-static-set',
|
||||
'protected-static-set',
|
||||
'private-static-set',
|
||||
'#private-static-set',
|
||||
'public-decorated-set',
|
||||
'protected-decorated-set',
|
||||
'private-decorated-set',
|
||||
'public-instance-set',
|
||||
'protected-instance-set',
|
||||
'private-instance-set',
|
||||
'#private-instance-set',
|
||||
'public-abstract-set',
|
||||
'protected-abstract-set',
|
||||
'public-set',
|
||||
'protected-set',
|
||||
'private-set',
|
||||
'#private-set',
|
||||
'static-set',
|
||||
'instance-set',
|
||||
'abstract-set',
|
||||
'decorated-set',
|
||||
'set',
|
||||
// Methods
|
||||
'public-static-method',
|
||||
'protected-static-method',
|
||||
'private-static-method',
|
||||
'#private-static-method',
|
||||
'public-decorated-method',
|
||||
'protected-decorated-method',
|
||||
'private-decorated-method',
|
||||
'public-instance-method',
|
||||
'protected-instance-method',
|
||||
'private-instance-method',
|
||||
'#private-instance-method',
|
||||
'public-abstract-method',
|
||||
'protected-abstract-method',
|
||||
'public-method',
|
||||
'protected-method',
|
||||
'private-method',
|
||||
'#private-method',
|
||||
'static-method',
|
||||
'instance-method',
|
||||
'abstract-method',
|
||||
'decorated-method',
|
||||
'method',
|
||||
];
|
||||
const allMemberTypes = Array.from([
|
||||
'readonly-signature',
|
||||
'signature',
|
||||
'readonly-field',
|
||||
'field',
|
||||
'method',
|
||||
'call-signature',
|
||||
'constructor',
|
||||
'accessor',
|
||||
'get',
|
||||
'set',
|
||||
'static-initialization',
|
||||
].reduce((all, type) => {
|
||||
all.add(type);
|
||||
['public', 'protected', 'private', '#private'].forEach(accessibility => {
|
||||
if (type !== 'readonly-signature' &&
|
||||
type !== 'signature' &&
|
||||
type !== 'static-initialization' &&
|
||||
type !== 'call-signature' &&
|
||||
!(type === 'constructor' && accessibility === '#private')) {
|
||||
all.add(`${accessibility}-${type}`); // e.g. `public-field`
|
||||
}
|
||||
// Only class instance fields, methods, accessors, get and set can have decorators attached to them
|
||||
if (accessibility !== '#private' &&
|
||||
(type === 'readonly-field' ||
|
||||
type === 'field' ||
|
||||
type === 'method' ||
|
||||
type === 'accessor' ||
|
||||
type === 'get' ||
|
||||
type === 'set')) {
|
||||
all.add(`${accessibility}-decorated-${type}`);
|
||||
all.add(`decorated-${type}`);
|
||||
}
|
||||
if (type !== 'constructor' &&
|
||||
type !== 'readonly-signature' &&
|
||||
type !== 'signature' &&
|
||||
type !== 'call-signature') {
|
||||
// There is no `static-constructor` or `instance-constructor` or `abstract-constructor`
|
||||
if (accessibility === '#private' || accessibility === 'private') {
|
||||
['static', 'instance'].forEach(scope => {
|
||||
all.add(`${scope}-${type}`);
|
||||
all.add(`${accessibility}-${scope}-${type}`);
|
||||
});
|
||||
}
|
||||
else {
|
||||
['static', 'instance', 'abstract'].forEach(scope => {
|
||||
all.add(`${scope}-${type}`);
|
||||
all.add(`${accessibility}-${scope}-${type}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return all;
|
||||
}, new Set()));
|
||||
const functionExpressions = [
|
||||
utils_1.AST_NODE_TYPES.FunctionExpression,
|
||||
utils_1.AST_NODE_TYPES.ArrowFunctionExpression,
|
||||
];
|
||||
/**
|
||||
* Gets the node type.
|
||||
*
|
||||
* @param node the node to be evaluated.
|
||||
*/
|
||||
function getNodeType(node) {
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition:
|
||||
case utils_1.AST_NODE_TYPES.MethodDefinition:
|
||||
case utils_1.AST_NODE_TYPES.TSMethodSignature:
|
||||
return node.kind;
|
||||
case utils_1.AST_NODE_TYPES.TSCallSignatureDeclaration:
|
||||
return 'call-signature';
|
||||
case utils_1.AST_NODE_TYPES.TSConstructSignatureDeclaration:
|
||||
return 'constructor';
|
||||
case utils_1.AST_NODE_TYPES.TSAbstractPropertyDefinition:
|
||||
case utils_1.AST_NODE_TYPES.TSPropertySignature:
|
||||
return node.readonly ? 'readonly-field' : 'field';
|
||||
case utils_1.AST_NODE_TYPES.TSAbstractAccessorProperty:
|
||||
case utils_1.AST_NODE_TYPES.AccessorProperty:
|
||||
return 'accessor';
|
||||
case utils_1.AST_NODE_TYPES.PropertyDefinition:
|
||||
return node.value && functionExpressions.includes(node.value.type)
|
||||
? 'method'
|
||||
: node.readonly
|
||||
? 'readonly-field'
|
||||
: 'field';
|
||||
case utils_1.AST_NODE_TYPES.TSIndexSignature:
|
||||
return node.readonly ? 'readonly-signature' : 'signature';
|
||||
case utils_1.AST_NODE_TYPES.StaticBlock:
|
||||
return 'static-initialization';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets the raw string value of a member's name
|
||||
*/
|
||||
function getMemberRawName(member, sourceCode) {
|
||||
const { name, type } = (0, util_1.getNameFromMember)(member, sourceCode);
|
||||
if (type === util_1.MemberNameType.Quoted) {
|
||||
return name.slice(1, -1);
|
||||
}
|
||||
if (type === util_1.MemberNameType.Private) {
|
||||
return name.slice(1);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* Gets the member name based on the member type.
|
||||
*
|
||||
* @param node the node to be evaluated.
|
||||
*/
|
||||
function getMemberName(node, sourceCode) {
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.TSPropertySignature:
|
||||
case utils_1.AST_NODE_TYPES.TSMethodSignature:
|
||||
case utils_1.AST_NODE_TYPES.TSAbstractAccessorProperty:
|
||||
case utils_1.AST_NODE_TYPES.TSAbstractPropertyDefinition:
|
||||
case utils_1.AST_NODE_TYPES.AccessorProperty:
|
||||
case utils_1.AST_NODE_TYPES.PropertyDefinition:
|
||||
return getMemberRawName(node, sourceCode);
|
||||
case utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition:
|
||||
case utils_1.AST_NODE_TYPES.MethodDefinition:
|
||||
return node.kind === 'constructor'
|
||||
? 'constructor'
|
||||
: getMemberRawName(node, sourceCode);
|
||||
case utils_1.AST_NODE_TYPES.TSConstructSignatureDeclaration:
|
||||
return 'new';
|
||||
case utils_1.AST_NODE_TYPES.TSCallSignatureDeclaration:
|
||||
return 'call';
|
||||
case utils_1.AST_NODE_TYPES.TSIndexSignature:
|
||||
return (0, util_1.getNameFromIndexSignature)(node);
|
||||
case utils_1.AST_NODE_TYPES.StaticBlock:
|
||||
return 'static block';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns true if the member is optional based on the member type.
|
||||
*
|
||||
* @param node the node to be evaluated.
|
||||
*
|
||||
* @returns Whether the member is optional, or false if it cannot be optional at all.
|
||||
*/
|
||||
function isMemberOptional(node) {
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.TSPropertySignature:
|
||||
case utils_1.AST_NODE_TYPES.TSMethodSignature:
|
||||
case utils_1.AST_NODE_TYPES.TSAbstractAccessorProperty:
|
||||
case utils_1.AST_NODE_TYPES.TSAbstractPropertyDefinition:
|
||||
case utils_1.AST_NODE_TYPES.AccessorProperty:
|
||||
case utils_1.AST_NODE_TYPES.PropertyDefinition:
|
||||
case utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition:
|
||||
case utils_1.AST_NODE_TYPES.MethodDefinition:
|
||||
return !!node.optional;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Gets the calculated rank using the provided method definition.
|
||||
* The algorithm is as follows:
|
||||
* - Get the rank based on the accessibility-scope-type name, e.g. public-instance-field
|
||||
* - If there is no order for accessibility-scope-type, then strip out the accessibility.
|
||||
* - If there is no order for scope-type, then strip out the scope.
|
||||
* - If there is no order for type, then return -1
|
||||
* @param memberGroups the valid names to be validated.
|
||||
* @param orderConfig the current order to be validated.
|
||||
*
|
||||
* @return Index of the matching member type in the order configuration.
|
||||
*/
|
||||
function getRankOrder(memberGroups, orderConfig) {
|
||||
let rank = -1;
|
||||
const stack = memberGroups.slice(); // Get a copy of the member groups
|
||||
while (stack.length > 0 && rank === -1) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const memberGroup = stack.shift();
|
||||
rank = orderConfig.findIndex(memberType => Array.isArray(memberType)
|
||||
? memberType.includes(memberGroup)
|
||||
: memberType === memberGroup);
|
||||
}
|
||||
return rank;
|
||||
}
|
||||
function getAccessibility(node) {
|
||||
if ('accessibility' in node && node.accessibility) {
|
||||
return node.accessibility;
|
||||
}
|
||||
if ('key' in node && node.key.type === utils_1.AST_NODE_TYPES.PrivateIdentifier) {
|
||||
return '#private';
|
||||
}
|
||||
return 'public';
|
||||
}
|
||||
/**
|
||||
* Gets the rank of the node given the order.
|
||||
* @param node the node to be evaluated.
|
||||
* @param orderConfig the current order to be validated.
|
||||
* @param supportsModifiers a flag indicating whether the type supports modifiers (scope or accessibility) or not.
|
||||
*/
|
||||
function getRank(node, orderConfig, supportsModifiers) {
|
||||
const type = getNodeType(node);
|
||||
if (type == null) {
|
||||
// shouldn't happen but just in case, put it on the end
|
||||
return orderConfig.length - 1;
|
||||
}
|
||||
const abstract = node.type === utils_1.AST_NODE_TYPES.TSAbstractAccessorProperty ||
|
||||
node.type === utils_1.AST_NODE_TYPES.TSAbstractPropertyDefinition ||
|
||||
node.type === utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition;
|
||||
const scope = 'static' in node && node.static
|
||||
? 'static'
|
||||
: abstract
|
||||
? 'abstract'
|
||||
: 'instance';
|
||||
const accessibility = getAccessibility(node);
|
||||
// Collect all existing member groups that apply to this node...
|
||||
// (e.g. 'public-instance-field', 'instance-field', 'public-field', 'constructor' etc.)
|
||||
const memberGroups = [];
|
||||
if (supportsModifiers) {
|
||||
const decorated = 'decorators' in node && node.decorators.length > 0;
|
||||
if (decorated &&
|
||||
(type === 'readonly-field' ||
|
||||
type === 'field' ||
|
||||
type === 'method' ||
|
||||
type === 'accessor' ||
|
||||
type === 'get' ||
|
||||
type === 'set')) {
|
||||
memberGroups.push(`${accessibility}-decorated-${type}`);
|
||||
memberGroups.push(`decorated-${type}`);
|
||||
if (type === 'readonly-field') {
|
||||
memberGroups.push(`${accessibility}-decorated-field`);
|
||||
memberGroups.push(`decorated-field`);
|
||||
}
|
||||
}
|
||||
if (type !== 'readonly-signature' &&
|
||||
type !== 'signature' &&
|
||||
type !== 'static-initialization') {
|
||||
if (type !== 'constructor') {
|
||||
// Constructors have no scope
|
||||
memberGroups.push(`${accessibility}-${scope}-${type}`);
|
||||
memberGroups.push(`${scope}-${type}`);
|
||||
if (type === 'readonly-field') {
|
||||
memberGroups.push(`${accessibility}-${scope}-field`);
|
||||
memberGroups.push(`${scope}-field`);
|
||||
}
|
||||
}
|
||||
memberGroups.push(`${accessibility}-${type}`);
|
||||
if (type === 'readonly-field') {
|
||||
memberGroups.push(`${accessibility}-field`);
|
||||
}
|
||||
}
|
||||
}
|
||||
memberGroups.push(type);
|
||||
if (type === 'readonly-signature') {
|
||||
memberGroups.push('signature');
|
||||
}
|
||||
else if (type === 'readonly-field') {
|
||||
memberGroups.push('field');
|
||||
}
|
||||
// ...then get the rank order for those member groups based on the node
|
||||
return getRankOrder(memberGroups, orderConfig);
|
||||
}
|
||||
/**
|
||||
* Groups members into arrays of consecutive members with the same rank.
|
||||
* If, for example, the memberSet parameter looks like the following...
|
||||
* @example
|
||||
* ```
|
||||
* interface Foo {
|
||||
* [a: string]: number;
|
||||
*
|
||||
* a: x;
|
||||
* B: x;
|
||||
* c: x;
|
||||
*
|
||||
* c(): void;
|
||||
* B(): void;
|
||||
* a(): void;
|
||||
*
|
||||
* (): Baz;
|
||||
*
|
||||
* new (): Bar;
|
||||
* }
|
||||
* ```
|
||||
* ...the resulting array will look like: [[a, B, c], [c, B, a]].
|
||||
* @param memberSet The members to be grouped.
|
||||
* @param memberType The configured order of member types.
|
||||
* @param supportsModifiers It'll get passed to getRank().
|
||||
* @returns The array of groups of members.
|
||||
*/
|
||||
function groupMembersByType(members, memberTypes, supportsModifiers) {
|
||||
const groupedMembers = [];
|
||||
const memberRanks = members.map(member => getRank(member, memberTypes, supportsModifiers));
|
||||
let previousRank = undefined;
|
||||
members.forEach((member, index) => {
|
||||
if (index === members.length - 1) {
|
||||
return;
|
||||
}
|
||||
const rankOfCurrentMember = memberRanks[index];
|
||||
const rankOfNextMember = memberRanks[index + 1];
|
||||
if (rankOfCurrentMember === previousRank) {
|
||||
groupedMembers.at(-1)?.push(member);
|
||||
}
|
||||
else if (rankOfCurrentMember === rankOfNextMember) {
|
||||
groupedMembers.push([member]);
|
||||
previousRank = rankOfCurrentMember;
|
||||
}
|
||||
});
|
||||
return groupedMembers;
|
||||
}
|
||||
/**
|
||||
* Gets the lowest possible rank(s) higher than target.
|
||||
* e.g. given the following order:
|
||||
* ...
|
||||
* public-static-method
|
||||
* protected-static-method
|
||||
* private-static-method
|
||||
* public-instance-method
|
||||
* protected-instance-method
|
||||
* private-instance-method
|
||||
* ...
|
||||
* and considering that a public-instance-method has already been declared, so ranks contains
|
||||
* public-instance-method, then the lowest possible rank for public-static-method is
|
||||
* public-instance-method.
|
||||
* If a lowest possible rank is a member group, a comma separated list of ranks is returned.
|
||||
* @param ranks the existing ranks in the object.
|
||||
* @param target the minimum target rank to filter on.
|
||||
* @param order the current order to be validated.
|
||||
* @returns the name(s) of the lowest possible rank without dashes (-).
|
||||
*/
|
||||
function getLowestRank(ranks, target, order) {
|
||||
let lowest = ranks[ranks.length - 1];
|
||||
ranks.forEach(rank => {
|
||||
if (rank > target) {
|
||||
lowest = Math.min(lowest, rank);
|
||||
}
|
||||
});
|
||||
const lowestRank = order[lowest];
|
||||
const lowestRanks = Array.isArray(lowestRank) ? lowestRank : [lowestRank];
|
||||
return lowestRanks.map(rank => rank.replace(/-/g, ' ')).join(', ');
|
||||
}
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'member-ordering',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Require a consistent member declaration order',
|
||||
},
|
||||
messages: {
|
||||
incorrectOrder: 'Member {{member}} should be declared before member {{beforeMember}}.',
|
||||
incorrectGroupOrder: 'Member {{name}} should be declared before all {{rank}} definitions.',
|
||||
incorrectRequiredMembersOrder: `Member {{member}} should be declared after all {{optionalOrRequired}} members.`,
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
$defs: {
|
||||
orderOptions: {
|
||||
type: 'string',
|
||||
enum: [
|
||||
'alphabetically',
|
||||
'alphabetically-case-insensitive',
|
||||
'as-written',
|
||||
'natural',
|
||||
'natural-case-insensitive',
|
||||
],
|
||||
},
|
||||
optionalityOrderOptions: {
|
||||
type: 'string',
|
||||
enum: ['optional-first', 'required-first'],
|
||||
},
|
||||
allItems: {
|
||||
type: 'string',
|
||||
enum: allMemberTypes,
|
||||
},
|
||||
typeItems: {
|
||||
type: 'string',
|
||||
enum: [
|
||||
'readonly-signature',
|
||||
'signature',
|
||||
'readonly-field',
|
||||
'field',
|
||||
'method',
|
||||
'constructor',
|
||||
],
|
||||
},
|
||||
baseConfig: {
|
||||
oneOf: [
|
||||
neverConfig,
|
||||
arrayConfig('#/items/0/$defs/allItems'),
|
||||
objectConfig('#/items/0/$defs/allItems'),
|
||||
],
|
||||
},
|
||||
typesConfig: {
|
||||
oneOf: [
|
||||
neverConfig,
|
||||
arrayConfig('#/items/0/$defs/typeItems'),
|
||||
objectConfig('#/items/0/$defs/typeItems'),
|
||||
],
|
||||
},
|
||||
},
|
||||
type: 'object',
|
||||
properties: {
|
||||
default: {
|
||||
$ref: '#/items/0/$defs/baseConfig',
|
||||
},
|
||||
classes: {
|
||||
$ref: '#/items/0/$defs/baseConfig',
|
||||
},
|
||||
classExpressions: {
|
||||
$ref: '#/items/0/$defs/baseConfig',
|
||||
},
|
||||
interfaces: {
|
||||
$ref: '#/items/0/$defs/typesConfig',
|
||||
},
|
||||
typeLiterals: {
|
||||
$ref: '#/items/0/$defs/typesConfig',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
default: {
|
||||
memberTypes: exports.defaultOrder,
|
||||
},
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
/**
|
||||
* Checks if the member groups are correctly sorted.
|
||||
*
|
||||
* @param members Members to be validated.
|
||||
* @param groupOrder Group order to be validated.
|
||||
* @param supportsModifiers A flag indicating whether the type supports modifiers (scope or accessibility) or not.
|
||||
*
|
||||
* @return Array of member groups or null if one of the groups is not correctly sorted.
|
||||
*/
|
||||
function checkGroupSort(members, groupOrder, supportsModifiers) {
|
||||
const previousRanks = [];
|
||||
const memberGroups = [];
|
||||
let isCorrectlySorted = true;
|
||||
// Find first member which isn't correctly sorted
|
||||
for (const member of members) {
|
||||
const rank = getRank(member, groupOrder, supportsModifiers);
|
||||
const name = getMemberName(member, context.sourceCode);
|
||||
const rankLastMember = previousRanks[previousRanks.length - 1];
|
||||
if (rank === -1) {
|
||||
continue;
|
||||
}
|
||||
// Works for 1st item because x < undefined === false for any x (typeof string)
|
||||
if (rank < rankLastMember) {
|
||||
context.report({
|
||||
node: member,
|
||||
messageId: 'incorrectGroupOrder',
|
||||
data: {
|
||||
name,
|
||||
rank: getLowestRank(previousRanks, rank, groupOrder),
|
||||
},
|
||||
});
|
||||
isCorrectlySorted = false;
|
||||
}
|
||||
else if (rank === rankLastMember) {
|
||||
// Same member group --> Push to existing member group array
|
||||
memberGroups[memberGroups.length - 1].push(member);
|
||||
}
|
||||
else {
|
||||
// New member group --> Create new member group array
|
||||
previousRanks.push(rank);
|
||||
memberGroups.push([member]);
|
||||
}
|
||||
}
|
||||
return isCorrectlySorted ? memberGroups : null;
|
||||
}
|
||||
/**
|
||||
* Checks if the members are alphabetically sorted.
|
||||
*
|
||||
* @param members Members to be validated.
|
||||
* @param order What order the members should be sorted in.
|
||||
*
|
||||
* @return True if all members are correctly sorted.
|
||||
*/
|
||||
function checkAlphaSort(members, order) {
|
||||
let previousName = '';
|
||||
let isCorrectlySorted = true;
|
||||
// Find first member which isn't correctly sorted
|
||||
members.forEach(member => {
|
||||
const name = getMemberName(member, context.sourceCode);
|
||||
// Note: Not all members have names
|
||||
if (name) {
|
||||
if (naturalOutOfOrder(name, previousName, order)) {
|
||||
context.report({
|
||||
node: member,
|
||||
messageId: 'incorrectOrder',
|
||||
data: {
|
||||
member: name,
|
||||
beforeMember: previousName,
|
||||
},
|
||||
});
|
||||
isCorrectlySorted = false;
|
||||
}
|
||||
previousName = name;
|
||||
}
|
||||
});
|
||||
return isCorrectlySorted;
|
||||
}
|
||||
function naturalOutOfOrder(name, previousName, order) {
|
||||
if (name === previousName) {
|
||||
return false;
|
||||
}
|
||||
switch (order) {
|
||||
case 'alphabetically':
|
||||
return name < previousName;
|
||||
case 'alphabetically-case-insensitive':
|
||||
return name.toLowerCase() < previousName.toLowerCase();
|
||||
case 'natural':
|
||||
return (0, natural_compare_1.default)(name, previousName) !== 1;
|
||||
case 'natural-case-insensitive':
|
||||
return ((0, natural_compare_1.default)(name.toLowerCase(), previousName.toLowerCase()) !== 1);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Checks if the order of optional and required members is correct based
|
||||
* on the given 'required' parameter.
|
||||
*
|
||||
* @param members Members to be validated.
|
||||
* @param optionalityOrder Where to place optional members, if not intermixed.
|
||||
*
|
||||
* @return True if all required and optional members are correctly sorted.
|
||||
*/
|
||||
function checkRequiredOrder(members, optionalityOrder) {
|
||||
const switchIndex = members.findIndex((member, i) => i && isMemberOptional(member) !== isMemberOptional(members[i - 1]));
|
||||
const report = (member) => context.report({
|
||||
messageId: 'incorrectRequiredMembersOrder',
|
||||
loc: member.loc,
|
||||
data: {
|
||||
member: getMemberName(member, context.sourceCode),
|
||||
optionalOrRequired: optionalityOrder === 'required-first' ? 'required' : 'optional',
|
||||
},
|
||||
});
|
||||
// if the optionality of the first item is correct (based on optionalityOrder)
|
||||
// then the first 0 inclusive to switchIndex exclusive members all
|
||||
// have the correct optionality
|
||||
if (isMemberOptional(members[0]) !==
|
||||
(optionalityOrder === 'optional-first')) {
|
||||
report(members[0]);
|
||||
return false;
|
||||
}
|
||||
for (let i = switchIndex + 1; i < members.length; i++) {
|
||||
if (isMemberOptional(members[i]) !==
|
||||
isMemberOptional(members[switchIndex])) {
|
||||
report(members[switchIndex]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Validates if all members are correctly sorted.
|
||||
*
|
||||
* @param members Members to be validated.
|
||||
* @param orderConfig Order config to be validated.
|
||||
* @param supportsModifiers A flag indicating whether the type supports modifiers (scope or accessibility) or not.
|
||||
*/
|
||||
function validateMembersOrder(members, orderConfig, supportsModifiers) {
|
||||
if (orderConfig === 'never') {
|
||||
return;
|
||||
}
|
||||
// Standardize config
|
||||
let order;
|
||||
let memberTypes;
|
||||
let optionalityOrder;
|
||||
/**
|
||||
* It runs an alphabetic sort on the groups of the members of the class in the source code.
|
||||
* @param memberSet The members in the class of the source code on which the grouping operation will be performed.
|
||||
*/
|
||||
const checkAlphaSortForAllMembers = (memberSet) => {
|
||||
const hasAlphaSort = !!(order && order !== 'as-written');
|
||||
if (hasAlphaSort && Array.isArray(memberTypes)) {
|
||||
groupMembersByType(memberSet, memberTypes, supportsModifiers).forEach(members => {
|
||||
checkAlphaSort(members, order);
|
||||
});
|
||||
}
|
||||
};
|
||||
// returns true if everything is good and false if an error was reported
|
||||
const checkOrder = (memberSet) => {
|
||||
const hasAlphaSort = !!(order && order !== 'as-written');
|
||||
// Check order
|
||||
if (Array.isArray(memberTypes)) {
|
||||
const grouped = checkGroupSort(memberSet, memberTypes, supportsModifiers);
|
||||
if (grouped == null) {
|
||||
checkAlphaSortForAllMembers(members);
|
||||
return false;
|
||||
}
|
||||
if (hasAlphaSort) {
|
||||
grouped.map(groupMember => checkAlphaSort(groupMember, order));
|
||||
}
|
||||
}
|
||||
else if (hasAlphaSort) {
|
||||
return checkAlphaSort(memberSet, order);
|
||||
}
|
||||
return false;
|
||||
};
|
||||
if (Array.isArray(orderConfig)) {
|
||||
memberTypes = orderConfig;
|
||||
}
|
||||
else {
|
||||
order = orderConfig.order;
|
||||
memberTypes = orderConfig.memberTypes;
|
||||
optionalityOrder = orderConfig.optionalityOrder;
|
||||
}
|
||||
if (!optionalityOrder) {
|
||||
checkOrder(members);
|
||||
return;
|
||||
}
|
||||
const switchIndex = members.findIndex((member, i) => i && isMemberOptional(member) !== isMemberOptional(members[i - 1]));
|
||||
if (switchIndex !== -1) {
|
||||
if (!checkRequiredOrder(members, optionalityOrder)) {
|
||||
return;
|
||||
}
|
||||
checkOrder(members.slice(0, switchIndex));
|
||||
checkOrder(members.slice(switchIndex));
|
||||
}
|
||||
else {
|
||||
checkOrder(members);
|
||||
}
|
||||
}
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/5439
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
return {
|
||||
'ClassDeclaration, FunctionDeclaration'(node) {
|
||||
if ('superClass' in node) {
|
||||
// ...
|
||||
}
|
||||
},
|
||||
ClassDeclaration(node) {
|
||||
validateMembersOrder(node.body.body, options.classes ?? options.default, true);
|
||||
},
|
||||
ClassExpression(node) {
|
||||
validateMembersOrder(node.body.body, options.classExpressions ?? options.default, true);
|
||||
},
|
||||
TSInterfaceDeclaration(node) {
|
||||
validateMembersOrder(node.body.body, options.interfaces ?? options.default, false);
|
||||
},
|
||||
TSTypeLiteral(node) {
|
||||
validateMembersOrder(node.members, options.typeLiterals ?? options.default, false);
|
||||
},
|
||||
};
|
||||
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=member-ordering.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
177
node_modules/@typescript-eslint/eslint-plugin/dist/rules/method-signature-style.js
generated
vendored
Normal file
177
node_modules/@typescript-eslint/eslint-plugin/dist/rules/method-signature-style.js
generated
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'method-signature-style',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce using a particular method signature syntax',
|
||||
},
|
||||
fixable: 'code',
|
||||
messages: {
|
||||
errorMethod: 'Shorthand method signature is forbidden. Use a function property instead.',
|
||||
errorProperty: 'Function property signature is forbidden. Use a method shorthand instead.',
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'string',
|
||||
enum: ['property', 'method'],
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: ['property'],
|
||||
create(context, [mode]) {
|
||||
function getMethodKey(node) {
|
||||
let key = context.sourceCode.getText(node.key);
|
||||
if (node.computed) {
|
||||
key = `[${key}]`;
|
||||
}
|
||||
if (node.optional) {
|
||||
key = `${key}?`;
|
||||
}
|
||||
if (node.readonly) {
|
||||
key = `readonly ${key}`;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
function getMethodParams(node) {
|
||||
let params = '()';
|
||||
if (node.params.length > 0) {
|
||||
const openingParen = (0, util_1.nullThrows)(context.sourceCode.getTokenBefore(node.params[0], util_1.isOpeningParenToken), 'Missing opening paren before first parameter');
|
||||
const closingParen = (0, util_1.nullThrows)(context.sourceCode.getTokenAfter(node.params[node.params.length - 1], util_1.isClosingParenToken), 'Missing closing paren after last parameter');
|
||||
params = context.sourceCode.text.substring(openingParen.range[0], closingParen.range[1]);
|
||||
}
|
||||
if (node.typeParameters != null) {
|
||||
const typeParams = context.sourceCode.getText(node.typeParameters);
|
||||
params = `${typeParams}${params}`;
|
||||
}
|
||||
return params;
|
||||
}
|
||||
function getMethodReturnType(node) {
|
||||
return node.returnType == null
|
||||
? // if the method has no return type, it implicitly has an `any` return type
|
||||
// we just make it explicit here so we can do the fix
|
||||
'any'
|
||||
: context.sourceCode.getText(node.returnType.typeAnnotation);
|
||||
}
|
||||
function getDelimiter(node) {
|
||||
const lastToken = context.sourceCode.getLastToken(node);
|
||||
if (lastToken &&
|
||||
((0, util_1.isSemicolonToken)(lastToken) || (0, util_1.isCommaToken)(lastToken))) {
|
||||
return lastToken.value;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
function isNodeParentModuleDeclaration(node) {
|
||||
if (!node.parent) {
|
||||
return false;
|
||||
}
|
||||
if (node.parent.type === utils_1.AST_NODE_TYPES.TSModuleDeclaration) {
|
||||
return true;
|
||||
}
|
||||
if (node.parent.type === utils_1.AST_NODE_TYPES.Program) {
|
||||
return false;
|
||||
}
|
||||
return isNodeParentModuleDeclaration(node.parent);
|
||||
}
|
||||
return {
|
||||
...(mode === 'property' && {
|
||||
TSMethodSignature(methodNode) {
|
||||
if (methodNode.kind !== 'method') {
|
||||
return;
|
||||
}
|
||||
const parent = methodNode.parent;
|
||||
const members = parent.type === utils_1.AST_NODE_TYPES.TSInterfaceBody
|
||||
? parent.body
|
||||
: parent.members;
|
||||
const duplicatedKeyMethodNodes = members.filter((element) => element.type === utils_1.AST_NODE_TYPES.TSMethodSignature &&
|
||||
element !== methodNode &&
|
||||
getMethodKey(element) === getMethodKey(methodNode));
|
||||
const isParentModule = isNodeParentModuleDeclaration(methodNode);
|
||||
if (duplicatedKeyMethodNodes.length > 0) {
|
||||
if (isParentModule) {
|
||||
context.report({
|
||||
node: methodNode,
|
||||
messageId: 'errorMethod',
|
||||
});
|
||||
}
|
||||
else {
|
||||
context.report({
|
||||
node: methodNode,
|
||||
messageId: 'errorMethod',
|
||||
*fix(fixer) {
|
||||
const methodNodes = [
|
||||
methodNode,
|
||||
...duplicatedKeyMethodNodes,
|
||||
].sort((a, b) => (a.range[0] < b.range[0] ? -1 : 1));
|
||||
const typeString = methodNodes
|
||||
.map(node => {
|
||||
const params = getMethodParams(node);
|
||||
const returnType = getMethodReturnType(node);
|
||||
return `(${params} => ${returnType})`;
|
||||
})
|
||||
.join(' & ');
|
||||
const key = getMethodKey(methodNode);
|
||||
const delimiter = getDelimiter(methodNode);
|
||||
yield fixer.replaceText(methodNode, `${key}: ${typeString}${delimiter}`);
|
||||
for (const node of duplicatedKeyMethodNodes) {
|
||||
const lastToken = context.sourceCode.getLastToken(node);
|
||||
if (lastToken) {
|
||||
const nextToken = context.sourceCode.getTokenAfter(lastToken);
|
||||
if (nextToken) {
|
||||
yield fixer.remove(node);
|
||||
yield fixer.replaceTextRange([lastToken.range[1], nextToken.range[0]], '');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (isParentModule) {
|
||||
context.report({
|
||||
node: methodNode,
|
||||
messageId: 'errorMethod',
|
||||
});
|
||||
}
|
||||
else {
|
||||
context.report({
|
||||
node: methodNode,
|
||||
messageId: 'errorMethod',
|
||||
fix: fixer => {
|
||||
const key = getMethodKey(methodNode);
|
||||
const params = getMethodParams(methodNode);
|
||||
const returnType = getMethodReturnType(methodNode);
|
||||
const delimiter = getDelimiter(methodNode);
|
||||
return fixer.replaceText(methodNode, `${key}: ${params} => ${returnType}${delimiter}`);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
}),
|
||||
...(mode === 'method' && {
|
||||
TSPropertySignature(propertyNode) {
|
||||
const typeNode = propertyNode.typeAnnotation?.typeAnnotation;
|
||||
if (typeNode?.type !== utils_1.AST_NODE_TYPES.TSFunctionType) {
|
||||
return;
|
||||
}
|
||||
context.report({
|
||||
node: propertyNode,
|
||||
messageId: 'errorProperty',
|
||||
fix: fixer => {
|
||||
const key = getMethodKey(propertyNode);
|
||||
const params = getMethodParams(typeNode);
|
||||
const returnType = getMethodReturnType(typeNode);
|
||||
const delimiter = getDelimiter(propertyNode);
|
||||
return fixer.replaceText(propertyNode, `${key}${params}: ${returnType}${delimiter}`);
|
||||
},
|
||||
});
|
||||
},
|
||||
}),
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=method-signature-style.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/method-signature-style.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/method-signature-style.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
103
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/enums.js
generated
vendored
Normal file
103
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/enums.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.UnderscoreOptions = exports.TypeModifiers = exports.Selectors = exports.PredefinedFormats = exports.Modifiers = exports.MetaSelectors = void 0;
|
||||
var PredefinedFormats;
|
||||
(function (PredefinedFormats) {
|
||||
PredefinedFormats[PredefinedFormats["camelCase"] = 1] = "camelCase";
|
||||
PredefinedFormats[PredefinedFormats["strictCamelCase"] = 2] = "strictCamelCase";
|
||||
PredefinedFormats[PredefinedFormats["PascalCase"] = 3] = "PascalCase";
|
||||
PredefinedFormats[PredefinedFormats["StrictPascalCase"] = 4] = "StrictPascalCase";
|
||||
PredefinedFormats[PredefinedFormats["snake_case"] = 5] = "snake_case";
|
||||
PredefinedFormats[PredefinedFormats["UPPER_CASE"] = 6] = "UPPER_CASE";
|
||||
})(PredefinedFormats || (exports.PredefinedFormats = PredefinedFormats = {}));
|
||||
var UnderscoreOptions;
|
||||
(function (UnderscoreOptions) {
|
||||
UnderscoreOptions[UnderscoreOptions["forbid"] = 1] = "forbid";
|
||||
UnderscoreOptions[UnderscoreOptions["allow"] = 2] = "allow";
|
||||
UnderscoreOptions[UnderscoreOptions["require"] = 3] = "require";
|
||||
// special cases as it's common practice to use double underscore
|
||||
UnderscoreOptions[UnderscoreOptions["requireDouble"] = 4] = "requireDouble";
|
||||
UnderscoreOptions[UnderscoreOptions["allowDouble"] = 5] = "allowDouble";
|
||||
UnderscoreOptions[UnderscoreOptions["allowSingleOrDouble"] = 6] = "allowSingleOrDouble";
|
||||
})(UnderscoreOptions || (exports.UnderscoreOptions = UnderscoreOptions = {}));
|
||||
var Selectors;
|
||||
(function (Selectors) {
|
||||
// variableLike
|
||||
Selectors[Selectors["variable"] = 1] = "variable";
|
||||
Selectors[Selectors["function"] = 2] = "function";
|
||||
Selectors[Selectors["parameter"] = 4] = "parameter";
|
||||
// memberLike
|
||||
Selectors[Selectors["parameterProperty"] = 8] = "parameterProperty";
|
||||
Selectors[Selectors["classicAccessor"] = 16] = "classicAccessor";
|
||||
Selectors[Selectors["enumMember"] = 32] = "enumMember";
|
||||
Selectors[Selectors["classMethod"] = 64] = "classMethod";
|
||||
Selectors[Selectors["objectLiteralMethod"] = 128] = "objectLiteralMethod";
|
||||
Selectors[Selectors["typeMethod"] = 256] = "typeMethod";
|
||||
Selectors[Selectors["classProperty"] = 512] = "classProperty";
|
||||
Selectors[Selectors["objectLiteralProperty"] = 1024] = "objectLiteralProperty";
|
||||
Selectors[Selectors["typeProperty"] = 2048] = "typeProperty";
|
||||
Selectors[Selectors["autoAccessor"] = 4096] = "autoAccessor";
|
||||
// typeLike
|
||||
Selectors[Selectors["class"] = 8192] = "class";
|
||||
Selectors[Selectors["interface"] = 16384] = "interface";
|
||||
Selectors[Selectors["typeAlias"] = 32768] = "typeAlias";
|
||||
Selectors[Selectors["enum"] = 65536] = "enum";
|
||||
Selectors[Selectors["typeParameter"] = 131072] = "typeParameter";
|
||||
// other
|
||||
Selectors[Selectors["import"] = 262144] = "import";
|
||||
})(Selectors || (exports.Selectors = Selectors = {}));
|
||||
var MetaSelectors;
|
||||
(function (MetaSelectors) {
|
||||
/* eslint-disable @typescript-eslint/prefer-literal-enum-member */
|
||||
MetaSelectors[MetaSelectors["default"] = -1] = "default";
|
||||
MetaSelectors[MetaSelectors["variableLike"] = 7] = "variableLike";
|
||||
MetaSelectors[MetaSelectors["memberLike"] = 8184] = "memberLike";
|
||||
MetaSelectors[MetaSelectors["typeLike"] = 253952] = "typeLike";
|
||||
MetaSelectors[MetaSelectors["method"] = 448] = "method";
|
||||
MetaSelectors[MetaSelectors["property"] = 3584] = "property";
|
||||
MetaSelectors[MetaSelectors["accessor"] = 4112] = "accessor";
|
||||
/* eslint-enable @typescript-eslint/prefer-literal-enum-member */
|
||||
})(MetaSelectors || (exports.MetaSelectors = MetaSelectors = {}));
|
||||
var Modifiers;
|
||||
(function (Modifiers) {
|
||||
// const variable
|
||||
Modifiers[Modifiers["const"] = 1] = "const";
|
||||
// readonly members
|
||||
Modifiers[Modifiers["readonly"] = 2] = "readonly";
|
||||
// static members
|
||||
Modifiers[Modifiers["static"] = 4] = "static";
|
||||
// member accessibility
|
||||
Modifiers[Modifiers["public"] = 8] = "public";
|
||||
Modifiers[Modifiers["protected"] = 16] = "protected";
|
||||
Modifiers[Modifiers["private"] = 32] = "private";
|
||||
Modifiers[Modifiers["#private"] = 64] = "#private";
|
||||
Modifiers[Modifiers["abstract"] = 128] = "abstract";
|
||||
// destructured variable
|
||||
Modifiers[Modifiers["destructured"] = 256] = "destructured";
|
||||
// variables declared in the top-level scope
|
||||
Modifiers[Modifiers["global"] = 512] = "global";
|
||||
// things that are exported
|
||||
Modifiers[Modifiers["exported"] = 1024] = "exported";
|
||||
// things that are unused
|
||||
Modifiers[Modifiers["unused"] = 2048] = "unused";
|
||||
// properties that require quoting
|
||||
Modifiers[Modifiers["requiresQuotes"] = 4096] = "requiresQuotes";
|
||||
// class members that are overridden
|
||||
Modifiers[Modifiers["override"] = 8192] = "override";
|
||||
// class methods, object function properties, or functions that are async via the `async` keyword
|
||||
Modifiers[Modifiers["async"] = 16384] = "async";
|
||||
// default imports
|
||||
Modifiers[Modifiers["default"] = 32768] = "default";
|
||||
// namespace imports
|
||||
Modifiers[Modifiers["namespace"] = 65536] = "namespace";
|
||||
// make sure TypeModifiers starts at Modifiers + 1 or else sorting won't work
|
||||
})(Modifiers || (exports.Modifiers = Modifiers = {}));
|
||||
var TypeModifiers;
|
||||
(function (TypeModifiers) {
|
||||
TypeModifiers[TypeModifiers["boolean"] = 131072] = "boolean";
|
||||
TypeModifiers[TypeModifiers["string"] = 262144] = "string";
|
||||
TypeModifiers[TypeModifiers["number"] = 524288] = "number";
|
||||
TypeModifiers[TypeModifiers["function"] = 1048576] = "function";
|
||||
TypeModifiers[TypeModifiers["array"] = 2097152] = "array";
|
||||
})(TypeModifiers || (exports.TypeModifiers = TypeModifiers = {}));
|
||||
//# sourceMappingURL=enums.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/enums.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/enums.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../../src/rules/naming-convention-utils/enums.ts"],"names":[],"mappings":";;;AAAA,IAAK,iBAOJ;AAPD,WAAK,iBAAiB;IACpB,mEAAa,CAAA;IACb,+EAAe,CAAA;IACf,qEAAU,CAAA;IACV,iFAAgB,CAAA;IAChB,qEAAU,CAAA;IACV,qEAAU,CAAA;AACZ,CAAC,EAPI,iBAAiB,iCAAjB,iBAAiB,QAOrB;AAGD,IAAK,iBASJ;AATD,WAAK,iBAAiB;IACpB,6DAAU,CAAA;IACV,2DAAK,CAAA;IACL,+DAAO,CAAA;IAEP,iEAAiE;IACjE,2EAAa,CAAA;IACb,uEAAW,CAAA;IACX,uFAAmB,CAAA;AACrB,CAAC,EATI,iBAAiB,iCAAjB,iBAAiB,Q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DAAkB,CAAA;IAClB,iGAAiG;IACjG,+CAAe,CAAA;IACf,kBAAkB;IAClB,mDAAiB,CAAA;IACjB,oBAAoB;IACpB,uDAAmB,CAAA;IAEnB,6EAA6E;AAC/E,CAAC,EAjCI,SAAS,yBAAT,SAAS,QAiCb;AAGD,IAAK,aAMJ;AAND,WAAK,aAAa;IAChB,4DAAiB,CAAA;IACjB,0DAAgB,CAAA;IAChB,0DAAgB,CAAA;IAChB,+DAAkB,CAAA;IAClB,yDAAe,CAAA;AACjB,CAAC,EANI,aAAa,6BAAb,aAAa,QAMjB"}
|
||||
91
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/format.js
generated
vendored
Normal file
91
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/format.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.PredefinedFormatToCheckFunction = void 0;
|
||||
const enums_1 = require("./enums");
|
||||
/*
|
||||
These format functions are taken from `tslint-consistent-codestyle/naming-convention`:
|
||||
https://github.com/ajafff/tslint-consistent-codestyle/blob/ab156cc8881bcc401236d999f4ce034b59039e81/rules/namingConventionRule.ts#L603-L645
|
||||
|
||||
The license for the code can be viewed here:
|
||||
https://github.com/ajafff/tslint-consistent-codestyle/blob/ab156cc8881bcc401236d999f4ce034b59039e81/LICENSE
|
||||
*/
|
||||
/*
|
||||
Why not regex here? Because it's actually really, really difficult to create a regex to handle
|
||||
all of the unicode cases, and we have many non-english users that use non-english characters.
|
||||
https://gist.github.com/mathiasbynens/6334847
|
||||
*/
|
||||
function isPascalCase(name) {
|
||||
return (name.length === 0 ||
|
||||
(name[0] === name[0].toUpperCase() && !name.includes('_')));
|
||||
}
|
||||
function isStrictPascalCase(name) {
|
||||
return (name.length === 0 ||
|
||||
(name[0] === name[0].toUpperCase() && hasStrictCamelHumps(name, true)));
|
||||
}
|
||||
function isCamelCase(name) {
|
||||
return (name.length === 0 ||
|
||||
(name[0] === name[0].toLowerCase() && !name.includes('_')));
|
||||
}
|
||||
function isStrictCamelCase(name) {
|
||||
return (name.length === 0 ||
|
||||
(name[0] === name[0].toLowerCase() && hasStrictCamelHumps(name, false)));
|
||||
}
|
||||
function hasStrictCamelHumps(name, isUpper) {
|
||||
function isUppercaseChar(char) {
|
||||
return char === char.toUpperCase() && char !== char.toLowerCase();
|
||||
}
|
||||
if (name.startsWith('_')) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 1; i < name.length; ++i) {
|
||||
if (name[i] === '_') {
|
||||
return false;
|
||||
}
|
||||
if (isUpper === isUppercaseChar(name[i])) {
|
||||
if (isUpper) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
isUpper = !isUpper;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function isSnakeCase(name) {
|
||||
return (name.length === 0 ||
|
||||
(name === name.toLowerCase() && validateUnderscores(name)));
|
||||
}
|
||||
function isUpperCase(name) {
|
||||
return (name.length === 0 ||
|
||||
(name === name.toUpperCase() && validateUnderscores(name)));
|
||||
}
|
||||
/** Check for leading trailing and adjacent underscores */
|
||||
function validateUnderscores(name) {
|
||||
if (name.startsWith('_')) {
|
||||
return false;
|
||||
}
|
||||
let wasUnderscore = false;
|
||||
for (let i = 1; i < name.length; ++i) {
|
||||
if (name[i] === '_') {
|
||||
if (wasUnderscore) {
|
||||
return false;
|
||||
}
|
||||
wasUnderscore = true;
|
||||
}
|
||||
else {
|
||||
wasUnderscore = false;
|
||||
}
|
||||
}
|
||||
return !wasUnderscore;
|
||||
}
|
||||
const PredefinedFormatToCheckFunction = {
|
||||
[enums_1.PredefinedFormats.PascalCase]: isPascalCase,
|
||||
[enums_1.PredefinedFormats.StrictPascalCase]: isStrictPascalCase,
|
||||
[enums_1.PredefinedFormats.camelCase]: isCamelCase,
|
||||
[enums_1.PredefinedFormats.strictCamelCase]: isStrictCamelCase,
|
||||
[enums_1.PredefinedFormats.UPPER_CASE]: isUpperCase,
|
||||
[enums_1.PredefinedFormats.snake_case]: isSnakeCase,
|
||||
};
|
||||
exports.PredefinedFormatToCheckFunction = PredefinedFormatToCheckFunction;
|
||||
//# sourceMappingURL=format.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/format.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/format.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/rules/naming-convention-utils/format.ts"],"names":[],"mappings":";;;AAAA,mCAA4C;AAE5C;;;;;;EAME;AAEF;;;;EAIE;AAEF,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,CACL,IAAI,CAAC,MAAM,KAAK,CAAC;QACjB,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAC3D,CAAC;AACJ,CAAC;AACD,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO,CACL,IAAI,CAAC,MAAM,KAAK,CAAC;QACjB,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CACvE,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO,CACL,IAAI,CAAC,MAAM,KAAK,CAAC;QACjB,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAC3D,CAAC;AACJ,CAAC;AACD,SAAS,iBAAiB,CAAC,IAAY;IACrC,OAAO,CACL,IAAI,CAAC,MAAM,KAAK,CAAC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AAC,CAAC,CAC3D,CAAC;AACJ,CAAC;AAED,0DAA0D;AAC1D,SAAS,mBAAmB,CAAC,IAAY;IACvC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,aAAa,GAAG,KAAK,CAAC;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YACpB,IAAI,aAAa,EAAE,CAAC;gBAClB,OAAO,KAAK,CAAC;YACf,CAAC;YACD,aAAa,GAAG,IAAI,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,aAAa,GAAG,KAAK,CAAC;QACxB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,aAAa,CAAC;AACxB,CAAC;AAED,MAAM,+BAA+B,GAEjC;IACF,CAAC,yBAAiB,CAAC,UAAU,CAAC,EAAE,YAAY;IAC5C,CAAC,yBAAiB,CAAC,gBAAgB,CAAC,EAAE,kBAAkB;IACxD,CAAC,yBAAiB,CAAC,SAAS,CAAC,EAAE,WAAW;IAC1C,CAAC,yBAAiB,CAAC,eAAe,CAAC,EAAE,iBAAiB;IACtD,CAAC,yBAAiB,CAAC,UAAU,CAAC,EAAE,WAAW;IAC3C,CAAC,yBAAiB,CAAC,UAAU,CAAC,EAAE,WAAW;CAC5C,CAAC;AAEO,0EAA+B"}
|
||||
12
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/index.js
generated
vendored
Normal file
12
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseOptions = exports.selectorTypeToMessageString = exports.SCHEMA = exports.Modifiers = void 0;
|
||||
var enums_1 = require("./enums");
|
||||
Object.defineProperty(exports, "Modifiers", { enumerable: true, get: function () { return enums_1.Modifiers; } });
|
||||
var schema_1 = require("./schema");
|
||||
Object.defineProperty(exports, "SCHEMA", { enumerable: true, get: function () { return schema_1.SCHEMA; } });
|
||||
var shared_1 = require("./shared");
|
||||
Object.defineProperty(exports, "selectorTypeToMessageString", { enumerable: true, get: function () { return shared_1.selectorTypeToMessageString; } });
|
||||
var parse_options_1 = require("./parse-options");
|
||||
Object.defineProperty(exports, "parseOptions", { enumerable: true, get: function () { return parse_options_1.parseOptions; } });
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/index.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rules/naming-convention-utils/index.ts"],"names":[],"mappings":";;;AAAA,iCAAoC;AAA3B,kGAAA,SAAS,OAAA;AAGlB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,mCAAuD;AAA9C,qHAAA,2BAA2B,OAAA;AACpC,iDAA+C;AAAtC,6GAAA,YAAY,OAAA"}
|
||||
72
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/parse-options.js
generated
vendored
Normal file
72
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/parse-options.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseOptions = parseOptions;
|
||||
const util_1 = require("../../util");
|
||||
const enums_1 = require("./enums");
|
||||
const shared_1 = require("./shared");
|
||||
const validator_1 = require("./validator");
|
||||
function normalizeOption(option) {
|
||||
let weight = 0;
|
||||
option.modifiers?.forEach(mod => {
|
||||
weight |= enums_1.Modifiers[mod];
|
||||
});
|
||||
option.types?.forEach(mod => {
|
||||
weight |= enums_1.TypeModifiers[mod];
|
||||
});
|
||||
// give selectors with a filter the _highest_ priority
|
||||
if (option.filter) {
|
||||
weight |= 1 << 30;
|
||||
}
|
||||
const normalizedOption = {
|
||||
// format options
|
||||
format: option.format ? option.format.map(f => enums_1.PredefinedFormats[f]) : null,
|
||||
custom: option.custom
|
||||
? {
|
||||
regex: new RegExp(option.custom.regex, 'u'),
|
||||
match: option.custom.match,
|
||||
}
|
||||
: null,
|
||||
leadingUnderscore: option.leadingUnderscore !== undefined
|
||||
? enums_1.UnderscoreOptions[option.leadingUnderscore]
|
||||
: null,
|
||||
trailingUnderscore: option.trailingUnderscore !== undefined
|
||||
? enums_1.UnderscoreOptions[option.trailingUnderscore]
|
||||
: null,
|
||||
prefix: option.prefix && option.prefix.length > 0 ? option.prefix : null,
|
||||
suffix: option.suffix && option.suffix.length > 0 ? option.suffix : null,
|
||||
modifiers: option.modifiers?.map(m => enums_1.Modifiers[m]) ?? null,
|
||||
types: option.types?.map(m => enums_1.TypeModifiers[m]) ?? null,
|
||||
filter: option.filter !== undefined
|
||||
? typeof option.filter === 'string'
|
||||
? {
|
||||
regex: new RegExp(option.filter, 'u'),
|
||||
match: true,
|
||||
}
|
||||
: {
|
||||
regex: new RegExp(option.filter.regex, 'u'),
|
||||
match: option.filter.match,
|
||||
}
|
||||
: null,
|
||||
// calculated ordering weight based on modifiers
|
||||
modifierWeight: weight,
|
||||
};
|
||||
const selectors = Array.isArray(option.selector)
|
||||
? option.selector
|
||||
: [option.selector];
|
||||
return selectors.map(selector => ({
|
||||
selector: (0, shared_1.isMetaSelector)(selector)
|
||||
? enums_1.MetaSelectors[selector]
|
||||
: enums_1.Selectors[selector],
|
||||
...normalizedOption,
|
||||
}));
|
||||
}
|
||||
function parseOptions(context) {
|
||||
const normalizedOptions = context.options.flatMap(normalizeOption);
|
||||
const result = (0, util_1.getEnumNames)(enums_1.Selectors).reduce((acc, k) => {
|
||||
acc[k] = (0, validator_1.createValidator)(k, context, normalizedOptions);
|
||||
return acc;
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-reduce-type-parameter
|
||||
}, {});
|
||||
return result;
|
||||
}
|
||||
//# sourceMappingURL=parse-options.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/parse-options.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/parse-options.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-options.js","sourceRoot":"","sources":["../../../src/rules/naming-convention-utils/parse-options.ts"],"names":[],"mappings":";;AA6FS,oCAAY;AA7FrB,qCAA0C;AAC1C,mCAOiB;AACjB,qCAA0C;AAO1C,2CAA8C;AAE9C,SAAS,eAAe,CAAC,MAAgB;IACvC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE;QAC9B,MAAM,IAAI,iBAAS,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE;QAC1B,MAAM,IAAI,qBAAa,CAAC,GAAG,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,sDAAsD;IACtD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;IAED,MAAM,gBAAgB,GAAG;QACvB,iBAAiB;QACjB,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,yBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;QAC3E,MAAM,EAAE,MAAM,CAAC,MAAM;YACnB,CAAC,CAAC;gBACE,KAAK,EAAE,IAAI,MAAM,CAAC,MAA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,KAAK,EAAE,GAAG,CAAC;oBAC3C,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK;iBAC3B;YACL,CAAC,CAAC,IAAI;QACV,gDAAgD;QAChD,cAAc,EAAE,MAAM;KACvB,CAAC;IAEF,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC9C,CAAC,CAAC,MAAM,CAAC,QAAQ;QACjB,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEtB,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAChC,QAAQ,EAAE,IAAA,uBAAc,EAAC,QAAQ,CAAC;YAChC,CAAC,CAAC,qBAAa,CAAC,QAAQ,CAAC;YACzB,CAAC,CAAC,iBAAS,CAAC,QAAQ,CAAC;QACvB,GAAG,gBAAgB;KACpB,CAAC,CAAC,CAAC;AACN,CAAC;AAED,SAAS,YAAY,CAAC,OAAgB;IACpC,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAEnE,MAAM,MAAM,GAAG,IAAA,mBAAY,EAAC,iBAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACvD,GAAG,CAAC,CAAC,CAAC,GAAG,IAAA,2BAAe,EAAC,CAAC,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;QACxD,OAAO,GAAG,CAAC;QACX,2EAA2E;IAC7E,CAAC,EAAE,EAAmB,CAAC,CAAC;IAExB,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
||||
307
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/schema.js
generated
vendored
Normal file
307
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/schema.js
generated
vendored
Normal file
@@ -0,0 +1,307 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.SCHEMA = void 0;
|
||||
const util_1 = require("../../util");
|
||||
const enums_1 = require("./enums");
|
||||
const $DEFS = {
|
||||
// enums
|
||||
underscoreOptions: {
|
||||
type: 'string',
|
||||
enum: (0, util_1.getEnumNames)(enums_1.UnderscoreOptions),
|
||||
},
|
||||
predefinedFormats: {
|
||||
type: 'string',
|
||||
enum: (0, util_1.getEnumNames)(enums_1.PredefinedFormats),
|
||||
},
|
||||
typeModifiers: {
|
||||
type: 'string',
|
||||
enum: (0, util_1.getEnumNames)(enums_1.TypeModifiers),
|
||||
},
|
||||
// repeated types
|
||||
prefixSuffixConfig: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
},
|
||||
additionalItems: false,
|
||||
},
|
||||
matchRegexConfig: {
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
match: { type: 'boolean' },
|
||||
regex: { type: 'string' },
|
||||
},
|
||||
required: ['match', 'regex'],
|
||||
},
|
||||
formatOptionsConfig: {
|
||||
oneOf: [
|
||||
{
|
||||
type: 'array',
|
||||
items: {
|
||||
$ref: '#/$defs/predefinedFormats',
|
||||
},
|
||||
additionalItems: false,
|
||||
},
|
||||
{
|
||||
type: 'null',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
const UNDERSCORE_SCHEMA = {
|
||||
$ref: '#/$defs/underscoreOptions',
|
||||
};
|
||||
const PREFIX_SUFFIX_SCHEMA = {
|
||||
$ref: '#/$defs/prefixSuffixConfig',
|
||||
};
|
||||
const MATCH_REGEX_SCHEMA = {
|
||||
$ref: '#/$defs/matchRegexConfig',
|
||||
};
|
||||
const FORMAT_OPTIONS_PROPERTIES = {
|
||||
format: {
|
||||
$ref: '#/$defs/formatOptionsConfig',
|
||||
},
|
||||
custom: MATCH_REGEX_SCHEMA,
|
||||
leadingUnderscore: UNDERSCORE_SCHEMA,
|
||||
trailingUnderscore: UNDERSCORE_SCHEMA,
|
||||
prefix: PREFIX_SUFFIX_SCHEMA,
|
||||
suffix: PREFIX_SUFFIX_SCHEMA,
|
||||
failureMessage: {
|
||||
type: 'string',
|
||||
},
|
||||
};
|
||||
function selectorSchema(selectorString, allowType, modifiers) {
|
||||
const selector = {
|
||||
filter: {
|
||||
oneOf: [
|
||||
{
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
},
|
||||
MATCH_REGEX_SCHEMA,
|
||||
],
|
||||
},
|
||||
selector: {
|
||||
type: 'string',
|
||||
enum: [selectorString],
|
||||
},
|
||||
};
|
||||
if (modifiers && modifiers.length > 0) {
|
||||
selector.modifiers = {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
enum: modifiers,
|
||||
},
|
||||
additionalItems: false,
|
||||
};
|
||||
}
|
||||
if (allowType) {
|
||||
selector.types = {
|
||||
type: 'array',
|
||||
items: {
|
||||
$ref: '#/$defs/typeModifiers',
|
||||
},
|
||||
additionalItems: false,
|
||||
};
|
||||
}
|
||||
return [
|
||||
{
|
||||
type: 'object',
|
||||
description: `Selector '${selectorString}'`,
|
||||
properties: {
|
||||
...FORMAT_OPTIONS_PROPERTIES,
|
||||
...selector,
|
||||
},
|
||||
required: ['selector', 'format'],
|
||||
additionalProperties: false,
|
||||
},
|
||||
];
|
||||
}
|
||||
function selectorsSchema() {
|
||||
return {
|
||||
type: 'object',
|
||||
description: 'Multiple selectors in one config',
|
||||
properties: {
|
||||
...FORMAT_OPTIONS_PROPERTIES,
|
||||
filter: {
|
||||
oneOf: [
|
||||
{
|
||||
type: 'string',
|
||||
minLength: 1,
|
||||
},
|
||||
MATCH_REGEX_SCHEMA,
|
||||
],
|
||||
},
|
||||
selector: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
enum: [...(0, util_1.getEnumNames)(enums_1.MetaSelectors), ...(0, util_1.getEnumNames)(enums_1.Selectors)],
|
||||
},
|
||||
additionalItems: false,
|
||||
},
|
||||
modifiers: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
enum: (0, util_1.getEnumNames)(enums_1.Modifiers),
|
||||
},
|
||||
additionalItems: false,
|
||||
},
|
||||
types: {
|
||||
type: 'array',
|
||||
items: {
|
||||
$ref: '#/$defs/typeModifiers',
|
||||
},
|
||||
additionalItems: false,
|
||||
},
|
||||
},
|
||||
required: ['selector', 'format'],
|
||||
additionalProperties: false,
|
||||
};
|
||||
}
|
||||
const SCHEMA = {
|
||||
$defs: $DEFS,
|
||||
type: 'array',
|
||||
items: {
|
||||
oneOf: [
|
||||
selectorsSchema(),
|
||||
...selectorSchema('default', false, (0, util_1.getEnumNames)(enums_1.Modifiers)),
|
||||
...selectorSchema('variableLike', false, ['unused', 'async']),
|
||||
...selectorSchema('variable', true, [
|
||||
'const',
|
||||
'destructured',
|
||||
'exported',
|
||||
'global',
|
||||
'unused',
|
||||
'async',
|
||||
]),
|
||||
...selectorSchema('function', false, [
|
||||
'exported',
|
||||
'global',
|
||||
'unused',
|
||||
'async',
|
||||
]),
|
||||
...selectorSchema('parameter', true, ['destructured', 'unused']),
|
||||
...selectorSchema('memberLike', false, [
|
||||
'abstract',
|
||||
'private',
|
||||
'#private',
|
||||
'protected',
|
||||
'public',
|
||||
'readonly',
|
||||
'requiresQuotes',
|
||||
'static',
|
||||
'override',
|
||||
'async',
|
||||
]),
|
||||
...selectorSchema('classProperty', true, [
|
||||
'abstract',
|
||||
'private',
|
||||
'#private',
|
||||
'protected',
|
||||
'public',
|
||||
'readonly',
|
||||
'requiresQuotes',
|
||||
'static',
|
||||
'override',
|
||||
]),
|
||||
...selectorSchema('objectLiteralProperty', true, [
|
||||
'public',
|
||||
'requiresQuotes',
|
||||
]),
|
||||
...selectorSchema('typeProperty', true, [
|
||||
'public',
|
||||
'readonly',
|
||||
'requiresQuotes',
|
||||
]),
|
||||
...selectorSchema('parameterProperty', true, [
|
||||
'private',
|
||||
'protected',
|
||||
'public',
|
||||
'readonly',
|
||||
]),
|
||||
...selectorSchema('property', true, [
|
||||
'abstract',
|
||||
'private',
|
||||
'#private',
|
||||
'protected',
|
||||
'public',
|
||||
'readonly',
|
||||
'requiresQuotes',
|
||||
'static',
|
||||
'override',
|
||||
'async',
|
||||
]),
|
||||
...selectorSchema('classMethod', false, [
|
||||
'abstract',
|
||||
'private',
|
||||
'#private',
|
||||
'protected',
|
||||
'public',
|
||||
'requiresQuotes',
|
||||
'static',
|
||||
'override',
|
||||
'async',
|
||||
]),
|
||||
...selectorSchema('objectLiteralMethod', false, [
|
||||
'public',
|
||||
'requiresQuotes',
|
||||
'async',
|
||||
]),
|
||||
...selectorSchema('typeMethod', false, ['public', 'requiresQuotes']),
|
||||
...selectorSchema('method', false, [
|
||||
'abstract',
|
||||
'private',
|
||||
'#private',
|
||||
'protected',
|
||||
'public',
|
||||
'requiresQuotes',
|
||||
'static',
|
||||
'override',
|
||||
'async',
|
||||
]),
|
||||
...selectorSchema('classicAccessor', true, [
|
||||
'abstract',
|
||||
'private',
|
||||
'protected',
|
||||
'public',
|
||||
'requiresQuotes',
|
||||
'static',
|
||||
'override',
|
||||
]),
|
||||
...selectorSchema('autoAccessor', true, [
|
||||
'abstract',
|
||||
'private',
|
||||
'protected',
|
||||
'public',
|
||||
'requiresQuotes',
|
||||
'static',
|
||||
'override',
|
||||
]),
|
||||
...selectorSchema('accessor', true, [
|
||||
'abstract',
|
||||
'private',
|
||||
'protected',
|
||||
'public',
|
||||
'requiresQuotes',
|
||||
'static',
|
||||
'override',
|
||||
]),
|
||||
...selectorSchema('enumMember', false, ['requiresQuotes']),
|
||||
...selectorSchema('typeLike', false, ['abstract', 'exported', 'unused']),
|
||||
...selectorSchema('class', false, ['abstract', 'exported', 'unused']),
|
||||
...selectorSchema('interface', false, ['exported', 'unused']),
|
||||
...selectorSchema('typeAlias', false, ['exported', 'unused']),
|
||||
...selectorSchema('enum', false, ['exported', 'unused']),
|
||||
...selectorSchema('typeParameter', false, ['unused']),
|
||||
...selectorSchema('import', false, ['default', 'namespace']),
|
||||
],
|
||||
},
|
||||
additionalItems: false,
|
||||
};
|
||||
exports.SCHEMA = SCHEMA;
|
||||
//# sourceMappingURL=schema.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/schema.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/schema.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
17
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/shared.js
generated
vendored
Normal file
17
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/shared.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.selectorTypeToMessageString = selectorTypeToMessageString;
|
||||
exports.isMetaSelector = isMetaSelector;
|
||||
exports.isMethodOrPropertySelector = isMethodOrPropertySelector;
|
||||
const enums_1 = require("./enums");
|
||||
function selectorTypeToMessageString(selectorType) {
|
||||
const notCamelCase = selectorType.replace(/([A-Z])/g, ' $1');
|
||||
return notCamelCase.charAt(0).toUpperCase() + notCamelCase.slice(1);
|
||||
}
|
||||
function isMetaSelector(selector) {
|
||||
return selector in enums_1.MetaSelectors;
|
||||
}
|
||||
function isMethodOrPropertySelector(selector) {
|
||||
return (selector === enums_1.MetaSelectors.method || selector === enums_1.MetaSelectors.property);
|
||||
}
|
||||
//# sourceMappingURL=shared.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/shared.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/shared.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/rules/naming-convention-utils/shared.ts"],"names":[],"mappings":";;AA4BE,kEAA2B;AAC3B,wCAAc;AACd,gEAA0B;AAxB5B,mCAAwC;AAExC,SAAS,2BAA2B,CAAC,YAA6B;IAChE,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC7D,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,cAAc,CACrB,QAAsE;IAEtE,OAAO,QAAQ,IAAI,qBAAa,CAAC;AACnC,CAAC;AAED,SAAS,0BAA0B,CACjC,QAAsE;IAEtE,OAAO,CACL,QAAQ,KAAK,qBAAa,CAAC,MAAM,IAAI,QAAQ,KAAK,qBAAa,CAAC,QAAQ,CACzE,CAAC;AACJ,CAAC"}
|
||||
3
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/types.js
generated
vendored
Normal file
3
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/types.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/types.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/rules/naming-convention-utils/types.ts"],"names":[],"mappings":""}
|
||||
350
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/validator.js
generated
vendored
Normal file
350
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/validator.js
generated
vendored
Normal file
@@ -0,0 +1,350 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createValidator = createValidator;
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../../util");
|
||||
const enums_1 = require("./enums");
|
||||
const format_1 = require("./format");
|
||||
const shared_1 = require("./shared");
|
||||
function createValidator(type, context, allConfigs) {
|
||||
// make sure the "highest priority" configs are checked first
|
||||
const selectorType = enums_1.Selectors[type];
|
||||
const configs = allConfigs
|
||||
// gather all of the applicable selectors
|
||||
.filter(c => (c.selector & selectorType) !== 0 ||
|
||||
c.selector === enums_1.MetaSelectors.default)
|
||||
.sort((a, b) => {
|
||||
if (a.selector === b.selector) {
|
||||
// in the event of the same selector, order by modifier weight
|
||||
// sort descending - the type modifiers are "more important"
|
||||
return b.modifierWeight - a.modifierWeight;
|
||||
}
|
||||
const aIsMeta = (0, shared_1.isMetaSelector)(a.selector);
|
||||
const bIsMeta = (0, shared_1.isMetaSelector)(b.selector);
|
||||
// non-meta selectors should go ahead of meta selectors
|
||||
if (aIsMeta && !bIsMeta) {
|
||||
return 1;
|
||||
}
|
||||
if (!aIsMeta && bIsMeta) {
|
||||
return -1;
|
||||
}
|
||||
const aIsMethodOrProperty = (0, shared_1.isMethodOrPropertySelector)(a.selector);
|
||||
const bIsMethodOrProperty = (0, shared_1.isMethodOrPropertySelector)(b.selector);
|
||||
// for backward compatibility, method and property have higher precedence than other meta selectors
|
||||
if (aIsMethodOrProperty && !bIsMethodOrProperty) {
|
||||
return -1;
|
||||
}
|
||||
if (!aIsMethodOrProperty && bIsMethodOrProperty) {
|
||||
return 1;
|
||||
}
|
||||
// both aren't meta selectors
|
||||
// sort descending - the meta selectors are "least important"
|
||||
return b.selector - a.selector;
|
||||
});
|
||||
return (node, modifiers = new Set()) => {
|
||||
const originalName = node.type === utils_1.AST_NODE_TYPES.Identifier ||
|
||||
node.type === utils_1.AST_NODE_TYPES.PrivateIdentifier
|
||||
? node.name
|
||||
: `${node.value}`;
|
||||
// return will break the loop and stop checking configs
|
||||
// it is only used when the name is known to have failed or succeeded a config.
|
||||
for (const config of configs) {
|
||||
if (config.filter?.regex.test(originalName) !== config.filter?.match) {
|
||||
// name does not match the filter
|
||||
continue;
|
||||
}
|
||||
if (config.modifiers?.some(modifier => !modifiers.has(modifier))) {
|
||||
// does not have the required modifiers
|
||||
continue;
|
||||
}
|
||||
if (!isCorrectType(node, config, context, selectorType)) {
|
||||
// is not the correct type
|
||||
continue;
|
||||
}
|
||||
let name = originalName;
|
||||
name = validateUnderscore('leading', config, name, node, originalName);
|
||||
if (name == null) {
|
||||
// fail
|
||||
return;
|
||||
}
|
||||
name = validateUnderscore('trailing', config, name, node, originalName);
|
||||
if (name == null) {
|
||||
// fail
|
||||
return;
|
||||
}
|
||||
name = validateAffix('prefix', config, name, node, originalName);
|
||||
if (name == null) {
|
||||
// fail
|
||||
return;
|
||||
}
|
||||
name = validateAffix('suffix', config, name, node, originalName);
|
||||
if (name == null) {
|
||||
// fail
|
||||
return;
|
||||
}
|
||||
if (!validateCustom(config, name, node, originalName)) {
|
||||
// fail
|
||||
return;
|
||||
}
|
||||
if (!validatePredefinedFormat(config, name, node, originalName, modifiers)) {
|
||||
// fail
|
||||
return;
|
||||
}
|
||||
// it's valid for this config, so we don't need to check any more configs
|
||||
return;
|
||||
}
|
||||
};
|
||||
// centralizes the logic for formatting the report data
|
||||
function formatReportData({ affixes, formats, originalName, processedName, position, custom, count, }) {
|
||||
return {
|
||||
type: (0, shared_1.selectorTypeToMessageString)(type),
|
||||
name: originalName,
|
||||
processedName,
|
||||
position,
|
||||
count,
|
||||
affixes: affixes?.join(', '),
|
||||
formats: formats?.map(f => enums_1.PredefinedFormats[f]).join(', '),
|
||||
regex: custom?.regex.toString(),
|
||||
regexMatch: custom?.match === true
|
||||
? 'match'
|
||||
: custom?.match === false
|
||||
? 'not match'
|
||||
: null,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @returns the name with the underscore removed, if it is valid according to the specified underscore option, null otherwise
|
||||
*/
|
||||
function validateUnderscore(position, config, name, node, originalName) {
|
||||
const option = position === 'leading'
|
||||
? config.leadingUnderscore
|
||||
: config.trailingUnderscore;
|
||||
if (!option) {
|
||||
return name;
|
||||
}
|
||||
const hasSingleUnderscore = position === 'leading'
|
||||
? () => name.startsWith('_')
|
||||
: () => name.endsWith('_');
|
||||
const trimSingleUnderscore = position === 'leading'
|
||||
? () => name.slice(1)
|
||||
: () => name.slice(0, -1);
|
||||
const hasDoubleUnderscore = position === 'leading'
|
||||
? () => name.startsWith('__')
|
||||
: () => name.endsWith('__');
|
||||
const trimDoubleUnderscore = position === 'leading'
|
||||
? () => name.slice(2)
|
||||
: () => name.slice(0, -2);
|
||||
switch (option) {
|
||||
// ALLOW - no conditions as the user doesn't care if it's there or not
|
||||
case enums_1.UnderscoreOptions.allow: {
|
||||
if (hasSingleUnderscore()) {
|
||||
return trimSingleUnderscore();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
case enums_1.UnderscoreOptions.allowDouble: {
|
||||
if (hasDoubleUnderscore()) {
|
||||
return trimDoubleUnderscore();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
case enums_1.UnderscoreOptions.allowSingleOrDouble: {
|
||||
if (hasDoubleUnderscore()) {
|
||||
return trimDoubleUnderscore();
|
||||
}
|
||||
if (hasSingleUnderscore()) {
|
||||
return trimSingleUnderscore();
|
||||
}
|
||||
return name;
|
||||
}
|
||||
// FORBID
|
||||
case enums_1.UnderscoreOptions.forbid: {
|
||||
if (hasSingleUnderscore()) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'unexpectedUnderscore',
|
||||
data: formatReportData({
|
||||
originalName,
|
||||
position,
|
||||
count: 'one',
|
||||
}),
|
||||
});
|
||||
return null;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
// REQUIRE
|
||||
case enums_1.UnderscoreOptions.require: {
|
||||
if (!hasSingleUnderscore()) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'missingUnderscore',
|
||||
data: formatReportData({
|
||||
originalName,
|
||||
position,
|
||||
count: 'one',
|
||||
}),
|
||||
});
|
||||
return null;
|
||||
}
|
||||
return trimSingleUnderscore();
|
||||
}
|
||||
case enums_1.UnderscoreOptions.requireDouble: {
|
||||
if (!hasDoubleUnderscore()) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'missingUnderscore',
|
||||
data: formatReportData({
|
||||
originalName,
|
||||
position,
|
||||
count: 'two',
|
||||
}),
|
||||
});
|
||||
return null;
|
||||
}
|
||||
return trimDoubleUnderscore();
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @returns the name with the affix removed, if it is valid according to the specified affix option, null otherwise
|
||||
*/
|
||||
function validateAffix(position, config, name, node, originalName) {
|
||||
const affixes = config[position];
|
||||
if (!affixes || affixes.length === 0) {
|
||||
return name;
|
||||
}
|
||||
for (const affix of affixes) {
|
||||
const hasAffix = position === 'prefix' ? name.startsWith(affix) : name.endsWith(affix);
|
||||
const trimAffix = position === 'prefix'
|
||||
? () => name.slice(affix.length)
|
||||
: () => name.slice(0, -affix.length);
|
||||
if (hasAffix) {
|
||||
// matches, so trim it and return
|
||||
return trimAffix();
|
||||
}
|
||||
}
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'missingAffix',
|
||||
data: formatReportData({
|
||||
originalName,
|
||||
position,
|
||||
affixes,
|
||||
}),
|
||||
});
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* @returns true if the name is valid according to the `regex` option, false otherwise
|
||||
*/
|
||||
function validateCustom(config, name, node, originalName) {
|
||||
const custom = config.custom;
|
||||
if (!custom) {
|
||||
return true;
|
||||
}
|
||||
const result = custom.regex.test(name);
|
||||
if (custom.match && result) {
|
||||
return true;
|
||||
}
|
||||
if (!custom.match && !result) {
|
||||
return true;
|
||||
}
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'satisfyCustom',
|
||||
data: formatReportData({
|
||||
originalName,
|
||||
custom,
|
||||
}),
|
||||
});
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @returns true if the name is valid according to the `format` option, false otherwise
|
||||
*/
|
||||
function validatePredefinedFormat(config, name, node, originalName, modifiers) {
|
||||
const formats = config.format;
|
||||
if (!formats?.length) {
|
||||
return true;
|
||||
}
|
||||
if (!modifiers.has(enums_1.Modifiers.requiresQuotes)) {
|
||||
for (const format of formats) {
|
||||
const checker = format_1.PredefinedFormatToCheckFunction[format];
|
||||
if (checker(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
context.report({
|
||||
node,
|
||||
messageId: originalName === name
|
||||
? 'doesNotMatchFormat'
|
||||
: 'doesNotMatchFormatTrimmed',
|
||||
data: formatReportData({
|
||||
originalName,
|
||||
processedName: name,
|
||||
formats,
|
||||
}),
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const SelectorsAllowedToHaveTypes = enums_1.Selectors.variable |
|
||||
enums_1.Selectors.parameter |
|
||||
enums_1.Selectors.classProperty |
|
||||
enums_1.Selectors.objectLiteralProperty |
|
||||
enums_1.Selectors.typeProperty |
|
||||
enums_1.Selectors.parameterProperty |
|
||||
enums_1.Selectors.classicAccessor;
|
||||
function isCorrectType(node, config, context, selector) {
|
||||
if (config.types == null) {
|
||||
return true;
|
||||
}
|
||||
if ((SelectorsAllowedToHaveTypes & selector) === 0) {
|
||||
return true;
|
||||
}
|
||||
const services = (0, util_1.getParserServices)(context);
|
||||
const checker = services.program.getTypeChecker();
|
||||
const type = services
|
||||
.getTypeAtLocation(node)
|
||||
// remove null and undefined from the type, as we don't care about it here
|
||||
.getNonNullableType();
|
||||
for (const allowedType of config.types) {
|
||||
switch (allowedType) {
|
||||
case enums_1.TypeModifiers.array:
|
||||
if (isAllTypesMatch(type, t => checker.isArrayType(t) || checker.isTupleType(t))) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case enums_1.TypeModifiers.function:
|
||||
if (isAllTypesMatch(type, t => t.getCallSignatures().length > 0)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case enums_1.TypeModifiers.boolean:
|
||||
case enums_1.TypeModifiers.number:
|
||||
case enums_1.TypeModifiers.string: {
|
||||
const typeString = checker.typeToString(
|
||||
// this will resolve things like true => boolean, 'a' => string and 1 => number
|
||||
checker.getWidenedType(checker.getBaseTypeOfLiteralType(type)));
|
||||
const allowedTypeString = enums_1.TypeModifiers[allowedType];
|
||||
if (typeString === allowedTypeString) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @returns `true` if the type (or all union types) in the given type return true for the callback
|
||||
*/
|
||||
function isAllTypesMatch(type, cb) {
|
||||
if (type.isUnion()) {
|
||||
return type.types.every(t => cb(t));
|
||||
}
|
||||
return cb(type);
|
||||
}
|
||||
//# sourceMappingURL=validator.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/validator.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/validator.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
504
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js
generated
vendored
Normal file
504
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js
generated
vendored
Normal file
@@ -0,0 +1,504 @@
|
||||
"use strict";
|
||||
// This rule was feature-frozen before we enabled no-property-in-node.
|
||||
/* eslint-disable eslint-plugin/no-property-in-node */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const scope_manager_1 = require("@typescript-eslint/scope-manager");
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util_1 = require("../util");
|
||||
const naming_convention_utils_1 = require("./naming-convention-utils");
|
||||
// This essentially mirrors ESLint's `camelcase` rule
|
||||
// note that that rule ignores leading and trailing underscores and only checks those in the middle of a variable name
|
||||
const defaultCamelCaseAllTheThingsConfig = [
|
||||
{
|
||||
selector: 'default',
|
||||
format: ['camelCase'],
|
||||
leadingUnderscore: 'allow',
|
||||
trailingUnderscore: 'allow',
|
||||
},
|
||||
{
|
||||
selector: 'import',
|
||||
format: ['camelCase', 'PascalCase'],
|
||||
},
|
||||
{
|
||||
selector: 'variable',
|
||||
format: ['camelCase', 'UPPER_CASE'],
|
||||
leadingUnderscore: 'allow',
|
||||
trailingUnderscore: 'allow',
|
||||
},
|
||||
{
|
||||
selector: 'typeLike',
|
||||
format: ['PascalCase'],
|
||||
},
|
||||
];
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'naming-convention',
|
||||
meta: {
|
||||
docs: {
|
||||
description: 'Enforce naming conventions for everything across a codebase',
|
||||
// technically only requires type checking if the user uses "type" modifiers
|
||||
requiresTypeChecking: true,
|
||||
},
|
||||
type: 'suggestion',
|
||||
messages: {
|
||||
unexpectedUnderscore: '{{type}} name `{{name}}` must not have a {{position}} underscore.',
|
||||
missingUnderscore: '{{type}} name `{{name}}` must have {{count}} {{position}} underscore(s).',
|
||||
missingAffix: '{{type}} name `{{name}}` must have one of the following {{position}}es: {{affixes}}',
|
||||
satisfyCustom: '{{type}} name `{{name}}` must {{regexMatch}} the RegExp: {{regex}}',
|
||||
doesNotMatchFormat: '{{type}} name `{{name}}` must match one of the following formats: {{formats}}',
|
||||
doesNotMatchFormatTrimmed: '{{type}} name `{{name}}` trimmed as `{{processedName}}` must match one of the following formats: {{formats}}',
|
||||
},
|
||||
schema: naming_convention_utils_1.SCHEMA,
|
||||
},
|
||||
defaultOptions: defaultCamelCaseAllTheThingsConfig,
|
||||
create(contextWithoutDefaults) {
|
||||
const context = contextWithoutDefaults.options.length > 0
|
||||
? contextWithoutDefaults
|
||||
: // only apply the defaults when the user provides no config
|
||||
Object.setPrototypeOf({
|
||||
options: defaultCamelCaseAllTheThingsConfig,
|
||||
}, contextWithoutDefaults);
|
||||
const validators = (0, naming_convention_utils_1.parseOptions)(context);
|
||||
const compilerOptions = (0, util_1.getParserServices)(context, true).program?.getCompilerOptions() ?? {};
|
||||
function handleMember(validator, node, modifiers) {
|
||||
const key = node.key;
|
||||
if (requiresQuoting(key, compilerOptions.target)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.requiresQuotes);
|
||||
}
|
||||
validator(key, modifiers);
|
||||
}
|
||||
function getMemberModifiers(node) {
|
||||
const modifiers = new Set();
|
||||
if ('key' in node && node.key.type === utils_1.AST_NODE_TYPES.PrivateIdentifier) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers['#private']);
|
||||
}
|
||||
else if (node.accessibility) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers[node.accessibility]);
|
||||
}
|
||||
else {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.public);
|
||||
}
|
||||
if (node.static) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.static);
|
||||
}
|
||||
if ('readonly' in node && node.readonly) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.readonly);
|
||||
}
|
||||
if ('override' in node && node.override) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.override);
|
||||
}
|
||||
if (node.type === utils_1.AST_NODE_TYPES.TSAbstractPropertyDefinition ||
|
||||
node.type === utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition ||
|
||||
node.type === utils_1.AST_NODE_TYPES.TSAbstractAccessorProperty) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.abstract);
|
||||
}
|
||||
return modifiers;
|
||||
}
|
||||
const { unusedVariables } = (0, util_1.collectVariables)(context);
|
||||
function isUnused(name, initialScope) {
|
||||
let variable = null;
|
||||
let scope = initialScope;
|
||||
while (scope) {
|
||||
variable = scope.set.get(name) ?? null;
|
||||
if (variable) {
|
||||
break;
|
||||
}
|
||||
scope = scope.upper;
|
||||
}
|
||||
if (!variable) {
|
||||
return false;
|
||||
}
|
||||
return unusedVariables.has(variable);
|
||||
}
|
||||
function isDestructured(id) {
|
||||
return (
|
||||
// `const { x }`
|
||||
// does not match `const { x: y }`
|
||||
(id.parent.type === utils_1.AST_NODE_TYPES.Property && id.parent.shorthand) ||
|
||||
// `const { x = 2 }`
|
||||
// does not match const `{ x: y = 2 }`
|
||||
(id.parent.type === utils_1.AST_NODE_TYPES.AssignmentPattern &&
|
||||
id.parent.parent.type === utils_1.AST_NODE_TYPES.Property &&
|
||||
id.parent.parent.shorthand));
|
||||
}
|
||||
function isAsyncMemberOrProperty(propertyOrMemberNode) {
|
||||
return Boolean('value' in propertyOrMemberNode &&
|
||||
propertyOrMemberNode.value &&
|
||||
'async' in propertyOrMemberNode.value &&
|
||||
propertyOrMemberNode.value.async);
|
||||
}
|
||||
function isAsyncVariableIdentifier(id) {
|
||||
return Boolean(('async' in id.parent && id.parent.async) ||
|
||||
('init' in id.parent &&
|
||||
id.parent.init &&
|
||||
'async' in id.parent.init &&
|
||||
id.parent.init.async));
|
||||
}
|
||||
const selectors = {
|
||||
// #region import
|
||||
'ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier': {
|
||||
validator: validators.import,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = new Set();
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.ImportDefaultSpecifier:
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.default);
|
||||
break;
|
||||
case utils_1.AST_NODE_TYPES.ImportNamespaceSpecifier:
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.namespace);
|
||||
break;
|
||||
case utils_1.AST_NODE_TYPES.ImportSpecifier:
|
||||
// Handle `import { default as Foo }`
|
||||
if (node.imported.name !== 'default') {
|
||||
return;
|
||||
}
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.default);
|
||||
break;
|
||||
}
|
||||
validator(node.local, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion
|
||||
// #region variable
|
||||
VariableDeclarator: {
|
||||
validator: validators.variable,
|
||||
handler: (node, validator) => {
|
||||
const identifiers = getIdentifiersFromPattern(node.id);
|
||||
const baseModifiers = new Set();
|
||||
const parent = node.parent;
|
||||
if (parent.kind === 'const') {
|
||||
baseModifiers.add(naming_convention_utils_1.Modifiers.const);
|
||||
}
|
||||
if (isGlobal(context.sourceCode.getScope(node))) {
|
||||
baseModifiers.add(naming_convention_utils_1.Modifiers.global);
|
||||
}
|
||||
identifiers.forEach(id => {
|
||||
const modifiers = new Set(baseModifiers);
|
||||
if (isDestructured(id)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.destructured);
|
||||
}
|
||||
const scope = context.sourceCode.getScope(id);
|
||||
if (isExported(parent, id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.exported);
|
||||
}
|
||||
if (isUnused(id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.unused);
|
||||
}
|
||||
if (isAsyncVariableIdentifier(id)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.async);
|
||||
}
|
||||
validator(id, modifiers);
|
||||
});
|
||||
},
|
||||
},
|
||||
// #endregion
|
||||
// #region function
|
||||
'FunctionDeclaration, TSDeclareFunction, FunctionExpression': {
|
||||
validator: validators.function,
|
||||
handler: (node, validator) => {
|
||||
if (node.id == null) {
|
||||
return;
|
||||
}
|
||||
const modifiers = new Set();
|
||||
// functions create their own nested scope
|
||||
const scope = context.sourceCode.getScope(node).upper;
|
||||
if (isGlobal(scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.global);
|
||||
}
|
||||
if (isExported(node, node.id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.exported);
|
||||
}
|
||||
if (isUnused(node.id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.unused);
|
||||
}
|
||||
if (node.async) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.async);
|
||||
}
|
||||
validator(node.id, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion function
|
||||
// #region parameter
|
||||
'FunctionDeclaration, TSDeclareFunction, TSEmptyBodyFunctionExpression, FunctionExpression, ArrowFunctionExpression': {
|
||||
validator: validators.parameter,
|
||||
handler: (node, validator) => {
|
||||
node.params.forEach(param => {
|
||||
if (param.type === utils_1.AST_NODE_TYPES.TSParameterProperty) {
|
||||
return;
|
||||
}
|
||||
const identifiers = getIdentifiersFromPattern(param);
|
||||
identifiers.forEach(i => {
|
||||
const modifiers = new Set();
|
||||
if (isDestructured(i)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.destructured);
|
||||
}
|
||||
if (isUnused(i.name, context.sourceCode.getScope(i))) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.unused);
|
||||
}
|
||||
validator(i, modifiers);
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
// #endregion parameter
|
||||
// #region parameterProperty
|
||||
TSParameterProperty: {
|
||||
validator: validators.parameterProperty,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = getMemberModifiers(node);
|
||||
const identifiers = getIdentifiersFromPattern(node.parameter);
|
||||
identifiers.forEach(i => {
|
||||
validator(i, modifiers);
|
||||
});
|
||||
},
|
||||
},
|
||||
// #endregion parameterProperty
|
||||
// #region property
|
||||
':not(ObjectPattern) > Property[computed = false][kind = "init"][value.type != "ArrowFunctionExpression"][value.type != "FunctionExpression"][value.type != "TSEmptyBodyFunctionExpression"]': {
|
||||
validator: validators.objectLiteralProperty,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = new Set([naming_convention_utils_1.Modifiers.public]);
|
||||
handleMember(validator, node, modifiers);
|
||||
},
|
||||
},
|
||||
':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type != "ArrowFunctionExpression"][value.type != "FunctionExpression"][value.type != "TSEmptyBodyFunctionExpression"]': {
|
||||
validator: validators.classProperty,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = getMemberModifiers(node);
|
||||
handleMember(validator, node, modifiers);
|
||||
},
|
||||
},
|
||||
'TSPropertySignature[computed = false][typeAnnotation.typeAnnotation.type != "TSFunctionType"]': {
|
||||
validator: validators.typeProperty,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = new Set([naming_convention_utils_1.Modifiers.public]);
|
||||
if (node.readonly) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.readonly);
|
||||
}
|
||||
handleMember(validator, node, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion property
|
||||
// #region method
|
||||
[[
|
||||
'Property[computed = false][kind = "init"][value.type = "ArrowFunctionExpression"]',
|
||||
'Property[computed = false][kind = "init"][value.type = "FunctionExpression"]',
|
||||
'Property[computed = false][kind = "init"][value.type = "TSEmptyBodyFunctionExpression"]',
|
||||
].join(', ')]: {
|
||||
validator: validators.objectLiteralMethod,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = new Set([naming_convention_utils_1.Modifiers.public]);
|
||||
if (isAsyncMemberOrProperty(node)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.async);
|
||||
}
|
||||
handleMember(validator, node, modifiers);
|
||||
},
|
||||
},
|
||||
[[
|
||||
':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type = "ArrowFunctionExpression"]',
|
||||
':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type = "FunctionExpression"]',
|
||||
':matches(PropertyDefinition, TSAbstractPropertyDefinition)[computed = false][value.type = "TSEmptyBodyFunctionExpression"]',
|
||||
':matches(MethodDefinition, TSAbstractMethodDefinition)[computed = false][kind = "method"]',
|
||||
].join(', ')]: {
|
||||
validator: validators.classMethod,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = getMemberModifiers(node);
|
||||
if (isAsyncMemberOrProperty(node)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.async);
|
||||
}
|
||||
handleMember(validator, node, modifiers);
|
||||
},
|
||||
},
|
||||
[[
|
||||
'TSMethodSignature[computed = false]',
|
||||
'TSPropertySignature[computed = false][typeAnnotation.typeAnnotation.type = "TSFunctionType"]',
|
||||
].join(', ')]: {
|
||||
validator: validators.typeMethod,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = new Set([naming_convention_utils_1.Modifiers.public]);
|
||||
handleMember(validator, node, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion method
|
||||
// #region accessor
|
||||
'Property[computed = false]:matches([kind = "get"], [kind = "set"])': {
|
||||
validator: validators.classicAccessor,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = new Set([naming_convention_utils_1.Modifiers.public]);
|
||||
handleMember(validator, node, modifiers);
|
||||
},
|
||||
},
|
||||
[[
|
||||
'MethodDefinition[computed = false]:matches([kind = "get"], [kind = "set"])',
|
||||
'TSAbstractMethodDefinition[computed = false]:matches([kind="get"], [kind="set"])',
|
||||
].join(', ')]: {
|
||||
validator: validators.classicAccessor,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = getMemberModifiers(node);
|
||||
handleMember(validator, node, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion accessor
|
||||
// #region autoAccessor
|
||||
[[
|
||||
utils_1.AST_NODE_TYPES.AccessorProperty,
|
||||
utils_1.AST_NODE_TYPES.TSAbstractAccessorProperty,
|
||||
].join(', ')]: {
|
||||
validator: validators.autoAccessor,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = getMemberModifiers(node);
|
||||
handleMember(validator, node, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion autoAccessor
|
||||
// #region enumMember
|
||||
// computed is optional, so can't do [computed = false]
|
||||
'TSEnumMember[computed != true]': {
|
||||
validator: validators.enumMember,
|
||||
handler: (node, validator) => {
|
||||
const id = node.id;
|
||||
const modifiers = new Set();
|
||||
if (requiresQuoting(id, compilerOptions.target)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.requiresQuotes);
|
||||
}
|
||||
validator(id, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion enumMember
|
||||
// #region class
|
||||
'ClassDeclaration, ClassExpression': {
|
||||
validator: validators.class,
|
||||
handler: (node, validator) => {
|
||||
const id = node.id;
|
||||
if (id == null) {
|
||||
return;
|
||||
}
|
||||
const modifiers = new Set();
|
||||
// classes create their own nested scope
|
||||
const scope = context.sourceCode.getScope(node).upper;
|
||||
if (node.abstract) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.abstract);
|
||||
}
|
||||
if (isExported(node, id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.exported);
|
||||
}
|
||||
if (isUnused(id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.unused);
|
||||
}
|
||||
validator(id, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion class
|
||||
// #region interface
|
||||
TSInterfaceDeclaration: {
|
||||
validator: validators.interface,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = new Set();
|
||||
const scope = context.sourceCode.getScope(node);
|
||||
if (isExported(node, node.id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.exported);
|
||||
}
|
||||
if (isUnused(node.id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.unused);
|
||||
}
|
||||
validator(node.id, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion interface
|
||||
// #region typeAlias
|
||||
TSTypeAliasDeclaration: {
|
||||
validator: validators.typeAlias,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = new Set();
|
||||
const scope = context.sourceCode.getScope(node);
|
||||
if (isExported(node, node.id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.exported);
|
||||
}
|
||||
if (isUnused(node.id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.unused);
|
||||
}
|
||||
validator(node.id, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion typeAlias
|
||||
// #region enum
|
||||
TSEnumDeclaration: {
|
||||
validator: validators.enum,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = new Set();
|
||||
// enums create their own nested scope
|
||||
const scope = context.sourceCode.getScope(node).upper;
|
||||
if (isExported(node, node.id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.exported);
|
||||
}
|
||||
if (isUnused(node.id.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.unused);
|
||||
}
|
||||
validator(node.id, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion enum
|
||||
// #region typeParameter
|
||||
'TSTypeParameterDeclaration > TSTypeParameter': {
|
||||
validator: validators.typeParameter,
|
||||
handler: (node, validator) => {
|
||||
const modifiers = new Set();
|
||||
const scope = context.sourceCode.getScope(node);
|
||||
if (isUnused(node.name.name, scope)) {
|
||||
modifiers.add(naming_convention_utils_1.Modifiers.unused);
|
||||
}
|
||||
validator(node.name, modifiers);
|
||||
},
|
||||
},
|
||||
// #endregion typeParameter
|
||||
};
|
||||
return Object.fromEntries(Object.entries(selectors).map(([selector, { validator, handler }]) => {
|
||||
return [
|
||||
selector,
|
||||
(node) => {
|
||||
handler(node, validator);
|
||||
},
|
||||
];
|
||||
}));
|
||||
},
|
||||
});
|
||||
function getIdentifiersFromPattern(pattern) {
|
||||
const identifiers = [];
|
||||
const visitor = new scope_manager_1.PatternVisitor({}, pattern, id => identifiers.push(id));
|
||||
visitor.visit(pattern);
|
||||
return identifiers;
|
||||
}
|
||||
function isExported(node, name, scope) {
|
||||
if (node?.parent?.type === utils_1.AST_NODE_TYPES.ExportDefaultDeclaration ||
|
||||
node?.parent?.type === utils_1.AST_NODE_TYPES.ExportNamedDeclaration) {
|
||||
return true;
|
||||
}
|
||||
if (scope == null) {
|
||||
return false;
|
||||
}
|
||||
const variable = scope.set.get(name);
|
||||
if (variable) {
|
||||
for (const ref of variable.references) {
|
||||
const refParent = ref.identifier.parent;
|
||||
if (refParent.type === utils_1.AST_NODE_TYPES.ExportDefaultDeclaration ||
|
||||
refParent.type === utils_1.AST_NODE_TYPES.ExportSpecifier) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isGlobal(scope) {
|
||||
if (scope == null) {
|
||||
return false;
|
||||
}
|
||||
return (scope.type === utils_1.TSESLint.Scope.ScopeType.global ||
|
||||
scope.type === utils_1.TSESLint.Scope.ScopeType.module);
|
||||
}
|
||||
function requiresQuoting(node, target) {
|
||||
const name = node.type === utils_1.AST_NODE_TYPES.Identifier ||
|
||||
node.type === utils_1.AST_NODE_TYPES.PrivateIdentifier
|
||||
? node.name
|
||||
: `${node.value}`;
|
||||
return (0, util_1.requiresQuoting)(name, target);
|
||||
}
|
||||
//# sourceMappingURL=naming-convention.js.map
|
||||
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js.map
generated
vendored
Normal file
1
node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user