Update checked-in dependencies
This commit is contained in:
parent
4fad06f438
commit
40a500c743
4168 changed files with 298222 additions and 374905 deletions
59
node_modules/eslint-plugin-github/README.md
generated
vendored
59
node_modules/eslint-plugin-github/README.md
generated
vendored
|
|
@ -3,7 +3,7 @@
|
|||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install --save-dev eslint eslint-plugin-github
|
||||
npm install --save-dev eslint eslint-plugin-github
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
|
@ -54,8 +54,8 @@ For each component, you may specify a `default` and/or `props`. `default` may ma
|
|||
"settings": {
|
||||
"github": {
|
||||
"components": {
|
||||
"Box": { "default": "p" },
|
||||
"Link": { "props": {"as": { "undefined": "a", "a": "a", "button": "button"}}},
|
||||
"Box": {"default": "p"},
|
||||
"Link": {"props": {"as": {"undefined": "a", "a": "a", "button": "button"}}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -72,25 +72,38 @@ This config will be interpreted in the following way:
|
|||
|
||||
### Rules
|
||||
|
||||
- [Array Foreach](./docs/rules/array-foreach.md)
|
||||
- [Async Currenttarget](./docs/rules/async-currenttarget.md)
|
||||
- [Async Preventdefault](./docs/rules/async-preventdefault.md)
|
||||
- [Authenticity Token](./docs/rules/authenticity-token.md)
|
||||
- [Get Attribute](./docs/rules/get-attribute.md)
|
||||
- [JS Class Name](./docs/rules/js-class-name.md)
|
||||
- [No Blur](./docs/rules/no-blur.md)
|
||||
- [No D None](./docs/rules/no-d-none.md)
|
||||
- [No Dataset](./docs/rules/no-dataset.md)
|
||||
- [No Dynamic Script Tag](./docs/rules/no-dynamic-script-tag.md)
|
||||
- [No Implicit Buggy Globals](./docs/rules/no-implicit-buggy-globals.md)
|
||||
- [No Inner HTML](./docs/rules/no-inner-html.md)
|
||||
- [No InnerText](./docs/rules/no-innerText.md)
|
||||
- [No Then](./docs/rules/no-then.md)
|
||||
- [No Useless Passive](./docs/rules/no-useless-passive.md)
|
||||
- [Prefer Observers](./docs/rules/prefer-observers.md)
|
||||
- [Require Passive Events](./docs/rules/require-passive-events.md)
|
||||
- [Unescaped HTML Literal](./docs/rules/unescaped-html-literal.md)
|
||||
<!-- begin auto-generated rules list -->
|
||||
|
||||
#### Accessibility-focused rules (prefixed with a11y)
|
||||
💼 Configurations enabled in.\
|
||||
🔍 Set in the `browser` configuration.\
|
||||
🔐 Set in the `internal` configuration.\
|
||||
⚛️ Set in the `react` configuration.\
|
||||
✅ Set in the `recommended` configuration.\
|
||||
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\
|
||||
❌ Deprecated.
|
||||
|
||||
- [No Generic Link Text](./docs/rules/a11y-no-generic-link-text.md)
|
||||
| Name | Description | 💼 | 🔧 | ❌ |
|
||||
| :----------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------- | :- | :- | :- |
|
||||
| [a11y-aria-label-is-well-formatted](docs/rules/a11y-aria-label-is-well-formatted.md) | [aria-label] text should be formatted as you would visual text. | ⚛️ | | |
|
||||
| [a11y-no-generic-link-text](docs/rules/a11y-no-generic-link-text.md) | disallow generic link text | | | ❌ |
|
||||
| [array-foreach](docs/rules/array-foreach.md) | enforce `for..of` loops over `Array.forEach` | ✅ | | |
|
||||
| [async-currenttarget](docs/rules/async-currenttarget.md) | disallow `event.currentTarget` calls inside of async functions | 🔍 | | |
|
||||
| [async-preventdefault](docs/rules/async-preventdefault.md) | disallow `event.preventDefault` calls inside of async functions | 🔍 | | |
|
||||
| [authenticity-token](docs/rules/authenticity-token.md) | disallow usage of CSRF tokens in JavaScript | 🔐 | | |
|
||||
| [get-attribute](docs/rules/get-attribute.md) | disallow wrong usage of attribute names | 🔍 | 🔧 | |
|
||||
| [js-class-name](docs/rules/js-class-name.md) | enforce a naming convention for js- prefixed classes | 🔐 | | |
|
||||
| [no-blur](docs/rules/no-blur.md) | disallow usage of `Element.prototype.blur()` | 🔍 | | |
|
||||
| [no-d-none](docs/rules/no-d-none.md) | disallow usage the `d-none` CSS class | 🔐 | | |
|
||||
| [no-dataset](docs/rules/no-dataset.md) | enforce usage of `Element.prototype.getAttribute` instead of `Element.prototype.datalist` | 🔍 | | |
|
||||
| [no-dynamic-script-tag](docs/rules/no-dynamic-script-tag.md) | disallow creating dynamic script tags | ✅ | | |
|
||||
| [no-implicit-buggy-globals](docs/rules/no-implicit-buggy-globals.md) | disallow implicit global variables | ✅ | | |
|
||||
| [no-inner-html](docs/rules/no-inner-html.md) | disallow `Element.prototype.innerHTML` in favor of `Element.prototype.textContent` | 🔍 | | |
|
||||
| [no-innerText](docs/rules/no-innerText.md) | disallow `Element.prototype.innerText` in favor of `Element.prototype.textContent` | 🔍 | 🔧 | |
|
||||
| [no-then](docs/rules/no-then.md) | enforce using `async/await` syntax over Promises | ✅ | | |
|
||||
| [no-useless-passive](docs/rules/no-useless-passive.md) | disallow marking a event handler as passive when it has no effect | 🔍 | 🔧 | |
|
||||
| [prefer-observers](docs/rules/prefer-observers.md) | disallow poorly performing event listeners | 🔍 | | |
|
||||
| [require-passive-events](docs/rules/require-passive-events.md) | enforce marking high frequency event handlers as passive | 🔍 | | |
|
||||
| [role-supports-aria-props](docs/rules/role-supports-aria-props.md) | Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`. | ⚛️ | | |
|
||||
| [unescaped-html-literal](docs/rules/unescaped-html-literal.md) | disallow unescaped HTML literals | 🔍 | | |
|
||||
|
||||
<!-- end auto-generated rules list -->
|
||||
|
|
|
|||
10
node_modules/eslint-plugin-github/lib/configs/browser.js
generated
vendored
10
node_modules/eslint-plugin-github/lib/configs/browser.js
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
module.exports = {
|
||||
env: {
|
||||
browser: true
|
||||
browser: true,
|
||||
},
|
||||
plugins: ['github', 'escompat'],
|
||||
extends: ['plugin:escompat/recommended'],
|
||||
|
|
@ -22,8 +22,8 @@ module.exports = {
|
|||
'error',
|
||||
{
|
||||
selector: "NewExpression[callee.name='URL'][arguments.length=1]",
|
||||
message: 'Please pass in `window.location.origin` as the 2nd argument to `new URL()`'
|
||||
}
|
||||
]
|
||||
}
|
||||
message: 'Please pass in `window.location.origin` as the 2nd argument to `new URL()`',
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
|
|
|||
4
node_modules/eslint-plugin-github/lib/configs/internal.js
generated
vendored
4
node_modules/eslint-plugin-github/lib/configs/internal.js
generated
vendored
|
|
@ -3,6 +3,6 @@ module.exports = {
|
|||
rules: {
|
||||
'github/authenticity-token': 'error',
|
||||
'github/js-class-name': 'error',
|
||||
'github/no-d-none': 'error'
|
||||
}
|
||||
'github/no-d-none': 'error',
|
||||
},
|
||||
}
|
||||
|
|
|
|||
18
node_modules/eslint-plugin-github/lib/configs/react.js
generated
vendored
18
node_modules/eslint-plugin-github/lib/configs/react.js
generated
vendored
|
|
@ -2,12 +2,22 @@ module.exports = {
|
|||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaFeatures: {
|
||||
jsx: true
|
||||
}
|
||||
jsx: true,
|
||||
},
|
||||
},
|
||||
plugins: ['github', 'jsx-a11y'],
|
||||
extends: ['plugin:jsx-a11y/recommended'],
|
||||
rules: {
|
||||
'github/a11y-no-generic-link-text': 'error'
|
||||
}
|
||||
'jsx-a11y/role-supports-aria-props': 'off', // Override with github/role-supports-aria-props until https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/910 is resolved
|
||||
'github/a11y-aria-label-is-well-formatted': 'error',
|
||||
'github/role-supports-aria-props': 'error',
|
||||
'jsx-a11y/no-aria-hidden-on-focusable': 'error',
|
||||
'jsx-a11y/no-autofocus': 'off',
|
||||
'jsx-a11y/anchor-ambiguous-text': [
|
||||
'error',
|
||||
{
|
||||
words: ['this', 'more', 'read here', 'read more'],
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
|
|
|||
24
node_modules/eslint-plugin-github/lib/configs/recommended.js
generated
vendored
24
node_modules/eslint-plugin-github/lib/configs/recommended.js
generated
vendored
|
|
@ -1,12 +1,12 @@
|
|||
module.exports = {
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
ecmaVersion: 6
|
||||
ecmaVersion: 6,
|
||||
},
|
||||
sourceType: 'module'
|
||||
sourceType: 'module',
|
||||
},
|
||||
env: {
|
||||
es6: true
|
||||
es6: true,
|
||||
},
|
||||
plugins: ['github', 'prettier', 'eslint-comments', 'import', 'filenames', 'i18n-text', 'no-only-tests'],
|
||||
rules: {
|
||||
|
|
@ -41,8 +41,8 @@ module.exports = {
|
|||
allowArray: true,
|
||||
allowArrowFunction: false,
|
||||
allowLiteral: true,
|
||||
allowObject: true
|
||||
}
|
||||
allowObject: true,
|
||||
},
|
||||
],
|
||||
'import/no-commonjs': 'error',
|
||||
'import/no-deprecated': 'error',
|
||||
|
|
@ -89,8 +89,8 @@ module.exports = {
|
|||
'no-only-tests/no-only-tests': [
|
||||
'error',
|
||||
{
|
||||
block: ['describe', 'it', 'context', 'test', 'tape', 'fixture', 'serial', 'suite']
|
||||
}
|
||||
block: ['describe', 'it', 'context', 'test', 'tape', 'fixture', 'serial', 'suite'],
|
||||
},
|
||||
],
|
||||
'no-redeclare': 'error',
|
||||
'no-regex-spaces': 'error',
|
||||
|
|
@ -122,13 +122,13 @@ module.exports = {
|
|||
'use-isnan': 'error',
|
||||
'valid-typeof': 'error',
|
||||
camelcase: ['error', {properties: 'always'}],
|
||||
eqeqeq: ['error', 'smart']
|
||||
eqeqeq: ['error', 'smart'],
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
node: {
|
||||
extensions: ['.js', '.ts']
|
||||
}
|
||||
}
|
||||
}
|
||||
extensions: ['.js', '.ts'],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
4
node_modules/eslint-plugin-github/lib/configs/typescript.js
generated
vendored
4
node_modules/eslint-plugin-github/lib/configs/typescript.js
generated
vendored
|
|
@ -16,6 +16,6 @@ module.exports = {
|
|||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'error',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off'
|
||||
}
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
},
|
||||
}
|
||||
|
|
|
|||
2
node_modules/eslint-plugin-github/lib/formatters/stylish-fixes.js
generated
vendored
2
node_modules/eslint-plugin-github/lib/formatters/stylish-fixes.js
generated
vendored
|
|
@ -65,7 +65,7 @@ module.exports = function (results) {
|
|||
', ',
|
||||
warnings,
|
||||
pluralize(' warning', warnings),
|
||||
')\n'
|
||||
')\n',
|
||||
].join('')
|
||||
}
|
||||
|
||||
|
|
|
|||
8
node_modules/eslint-plugin-github/lib/index.js
generated
vendored
8
node_modules/eslint-plugin-github/lib/index.js
generated
vendored
|
|
@ -1,6 +1,7 @@
|
|||
module.exports = {
|
||||
rules: {
|
||||
'a11y-no-generic-link-text': require('./rules/a11y-no-generic-link-text'),
|
||||
'a11y-aria-label-is-well-formatted': require('./rules/a11y-aria-label-is-well-formatted'),
|
||||
'array-foreach': require('./rules/array-foreach'),
|
||||
'async-currenttarget': require('./rules/async-currenttarget'),
|
||||
'async-preventdefault': require('./rules/async-preventdefault'),
|
||||
|
|
@ -17,14 +18,15 @@ module.exports = {
|
|||
'no-then': require('./rules/no-then'),
|
||||
'no-useless-passive': require('./rules/no-useless-passive'),
|
||||
'prefer-observers': require('./rules/prefer-observers'),
|
||||
'role-supports-aria-props': require('./rules/role-supports-aria-props'),
|
||||
'require-passive-events': require('./rules/require-passive-events'),
|
||||
'unescaped-html-literal': require('./rules/unescaped-html-literal')
|
||||
'unescaped-html-literal': require('./rules/unescaped-html-literal'),
|
||||
},
|
||||
configs: {
|
||||
browser: require('./configs/browser'),
|
||||
internal: require('./configs/internal'),
|
||||
recommended: require('./configs/recommended'),
|
||||
typescript: require('./configs/typescript'),
|
||||
react: require('./configs/react')
|
||||
}
|
||||
react: require('./configs/react'),
|
||||
},
|
||||
}
|
||||
|
|
|
|||
31
node_modules/eslint-plugin-github/lib/rules/a11y-aria-label-is-well-formatted.js
generated
vendored
Normal file
31
node_modules/eslint-plugin-github/lib/rules/a11y-aria-label-is-well-formatted.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
const {getProp} = require('jsx-ast-utils')
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
docs: {
|
||||
description: '[aria-label] text should be formatted as you would visual text.',
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
JSXOpeningElement: node => {
|
||||
const prop = getProp(node.attributes, 'aria-label')
|
||||
if (!prop) return
|
||||
|
||||
const propValue = prop.value
|
||||
if (propValue.type !== 'Literal') return
|
||||
|
||||
const ariaLabel = propValue.value
|
||||
if (ariaLabel.match(/^[a-z]+.*$/)) {
|
||||
context.report({
|
||||
node,
|
||||
message: '[aria-label] text should be formatted the same as you would visual text. Use sentence case.',
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
16
node_modules/eslint-plugin-github/lib/rules/a11y-no-generic-link-text.js
generated
vendored
16
node_modules/eslint-plugin-github/lib/rules/a11y-no-generic-link-text.js
generated
vendored
|
|
@ -16,9 +16,11 @@ module.exports = {
|
|||
meta: {
|
||||
docs: {
|
||||
description: 'disallow generic link text',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
deprecated: true,
|
||||
replacedBy: ['jsx-a11y/anchor-ambiguous-text'],
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -46,13 +48,13 @@ module.exports = {
|
|||
context.report({
|
||||
node,
|
||||
message:
|
||||
'Avoid setting generic link text like `Here`, `Click here`, `Read more`. Make sure that your link text is both descriptive and concise.'
|
||||
'Avoid setting generic link text like `Here`, `Click here`, `Read more`. Make sure that your link text is both descriptive and concise.',
|
||||
})
|
||||
}
|
||||
if (cleanTextContent && !cleanAriaLabelValue.includes(cleanTextContent)) {
|
||||
context.report({
|
||||
node,
|
||||
message: 'When using ARIA to set a more descriptive text, it must fully contain the visible label.'
|
||||
message: 'When using ARIA to set a more descriptive text, it must fully contain the visible label.',
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
|
@ -61,11 +63,11 @@ module.exports = {
|
|||
context.report({
|
||||
node: jsxTextNode,
|
||||
message:
|
||||
'Avoid setting generic link text like `Here`, `Click here`, `Read more`. Make sure that your link text is both descriptive and concise.'
|
||||
'Avoid setting generic link text like `Here`, `Click here`, `Read more`. Make sure that your link text is both descriptive and concise.',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
8
node_modules/eslint-plugin-github/lib/rules/array-foreach.js
generated
vendored
8
node_modules/eslint-plugin-github/lib/rules/array-foreach.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'enforce `for..of` loops over `Array.forEach`',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -14,7 +14,7 @@ module.exports = {
|
|||
if (node.callee.property && node.callee.property.name === 'forEach') {
|
||||
context.report({node, message: 'Prefer for...of instead of Array.forEach'})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
8
node_modules/eslint-plugin-github/lib/rules/async-currenttarget.js
generated
vendored
8
node_modules/eslint-plugin-github/lib/rules/async-currenttarget.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow `event.currentTarget` calls inside of async functions',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -22,7 +22,7 @@ module.exports = {
|
|||
context.report({node, message: 'event.currentTarget inside an async function is error prone'})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
8
node_modules/eslint-plugin-github/lib/rules/async-preventdefault.js
generated
vendored
8
node_modules/eslint-plugin-github/lib/rules/async-preventdefault.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow `event.preventDefault` calls inside of async functions',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -22,7 +22,7 @@ module.exports = {
|
|||
context.report({node, message: 'event.preventDefault() inside an async function is error prone'})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
10
node_modules/eslint-plugin-github/lib/rules/authenticity-token.js
generated
vendored
10
node_modules/eslint-plugin-github/lib/rules/authenticity-token.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow usage of CSRF tokens in JavaScript',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -14,7 +14,7 @@ module.exports = {
|
|||
context.report({
|
||||
node,
|
||||
message:
|
||||
'Form CSRF tokens (authenticity tokens) should not be created in JavaScript and their values should not be used directly for XHR requests.'
|
||||
'Form CSRF tokens (authenticity tokens) should not be created in JavaScript and their values should not be used directly for XHR requests.',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ module.exports = {
|
|||
if (typeof node.value === 'string') {
|
||||
checkAuthenticityTokenUsage(node, node.value)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
10
node_modules/eslint-plugin-github/lib/rules/get-attribute.js
generated
vendored
10
node_modules/eslint-plugin-github/lib/rules/get-attribute.js
generated
vendored
|
|
@ -22,10 +22,10 @@ module.exports = {
|
|||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow wrong usage of attribute names',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
fixable: 'code',
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
|
|
@ -44,10 +44,10 @@ module.exports = {
|
|||
message: 'Attributes should be lowercase and hyphen separated, or part of the SVG whitelist.',
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(attributeNameNode, `'${attributeNameNode.value.toLowerCase()}'`)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
8
node_modules/eslint-plugin-github/lib/rules/js-class-name.js
generated
vendored
8
node_modules/eslint-plugin-github/lib/rules/js-class-name.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'enforce a naming convention for js- prefixed classes',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -51,7 +51,7 @@ module.exports = {
|
|||
checkStringEndsWithJSClassName(quasi, quasi.value.raw)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
8
node_modules/eslint-plugin-github/lib/rules/no-blur.js
generated
vendored
8
node_modules/eslint-plugin-github/lib/rules/no-blur.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow usage of `Element.prototype.blur()`',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
|
|
@ -13,7 +13,7 @@ module.exports = {
|
|||
if (node.callee.property && node.callee.property.name === 'blur') {
|
||||
context.report({node, message: 'Do not use element.blur(), instead restore the focus of a previous element.'})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
10
node_modules/eslint-plugin-github/lib/rules/no-d-none.js
generated
vendored
10
node_modules/eslint-plugin-github/lib/rules/no-d-none.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow usage the `d-none` CSS class',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
|
|
@ -21,11 +21,11 @@ module.exports = {
|
|||
if (invalidArgument) {
|
||||
context.report({
|
||||
node,
|
||||
message: 'Prefer hidden property to d-none class'
|
||||
message: 'Prefer hidden property to d-none class',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
8
node_modules/eslint-plugin-github/lib/rules/no-dataset.js
generated
vendored
8
node_modules/eslint-plugin-github/lib/rules/no-dataset.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'problem',
|
||||
docs: {
|
||||
description: 'enforce usage of `Element.prototype.getAttribute` instead of `Element.prototype.datalist`',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -14,7 +14,7 @@ module.exports = {
|
|||
if (node.property && node.property.name === 'dataset') {
|
||||
context.report({node, message: "Use getAttribute('data-your-attribute') instead of dataset."})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
12
node_modules/eslint-plugin-github/lib/rules/no-dynamic-script-tag.js
generated
vendored
12
node_modules/eslint-plugin-github/lib/rules/no-dynamic-script-tag.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'disallow creating dynamic script tags',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -15,15 +15,15 @@ module.exports = {
|
|||
|
||||
context.report({
|
||||
node: node.arguments[0],
|
||||
message: "Don't create dynamic script tags, add them in the server template instead."
|
||||
message: "Don't create dynamic script tags, add them in the server template instead.",
|
||||
})
|
||||
},
|
||||
'AssignmentExpression[left.property.name="type"][right.value="text/javascript"]': function (node) {
|
||||
context.report({
|
||||
node: node.right,
|
||||
message: "Don't create dynamic script tags, add them in the server template instead."
|
||||
message: "Don't create dynamic script tags, add them in the server template instead.",
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
8
node_modules/eslint-plugin-github/lib/rules/no-implicit-buggy-globals.js
generated
vendored
8
node_modules/eslint-plugin-github/lib/rules/no-implicit-buggy-globals.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow implicit global variables',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -29,7 +29,7 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
10
node_modules/eslint-plugin-github/lib/rules/no-inner-html.js
generated
vendored
10
node_modules/eslint-plugin-github/lib/rules/no-inner-html.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow `Element.prototype.innerHTML` in favor of `Element.prototype.textContent`',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -13,9 +13,9 @@ module.exports = {
|
|||
'MemberExpression[property.name=innerHTML]': function (node) {
|
||||
context.report({
|
||||
node: node.property,
|
||||
message: 'Using innerHTML poses a potential security risk and should not be used. Prefer using textContent.'
|
||||
message: 'Using innerHTML poses a potential security risk and should not be used. Prefer using textContent.',
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
12
node_modules/eslint-plugin-github/lib/rules/no-innerText.js
generated
vendored
12
node_modules/eslint-plugin-github/lib/rules/no-innerText.js
generated
vendored
|
|
@ -3,10 +3,10 @@ module.exports = {
|
|||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow `Element.prototype.innerText` in favor of `Element.prototype.textContent`',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
fixable: 'code',
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -15,16 +15,16 @@ module.exports = {
|
|||
if (node.property && node.property.name === 'innerText') {
|
||||
context.report({
|
||||
meta: {
|
||||
fixable: 'code'
|
||||
fixable: 'code',
|
||||
},
|
||||
node: node.property,
|
||||
message: 'Prefer textContent to innerText',
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(node.property, 'textContent')
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
8
node_modules/eslint-plugin-github/lib/rules/no-then.js
generated
vendored
8
node_modules/eslint-plugin-github/lib/rules/no-then.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'enforce using `async/await` syntax over Promises',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -16,7 +16,7 @@ module.exports = {
|
|||
} else if (node.property && node.property.name === 'catch') {
|
||||
context.report({node: node.property, message: 'Prefer async/await to Promise.catch()'})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
20
node_modules/eslint-plugin-github/lib/rules/no-useless-passive.js
generated
vendored
20
node_modules/eslint-plugin-github/lib/rules/no-useless-passive.js
generated
vendored
|
|
@ -1,4 +1,12 @@
|
|||
const passiveEventListenerNames = new Set(['touchstart', 'touchmove', 'wheel', 'mousewheel'])
|
||||
const passiveEventListenerNames = new Set([
|
||||
'touchstart',
|
||||
'touchmove',
|
||||
'touchenter',
|
||||
'touchend',
|
||||
'touchleave',
|
||||
'wheel',
|
||||
'mousewheel',
|
||||
])
|
||||
|
||||
const propIsPassiveTrue = prop => prop.key && prop.key.name === 'passive' && prop.value && prop.value.value === true
|
||||
|
||||
|
|
@ -7,10 +15,10 @@ module.exports = {
|
|||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'disallow marking a event handler as passive when it has no effect',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
fixable: 'code',
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -42,10 +50,10 @@ module.exports = {
|
|||
}
|
||||
}
|
||||
return removals.map(t => fixer.remove(t))
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
12
node_modules/eslint-plugin-github/lib/rules/prefer-observers.js
generated
vendored
12
node_modules/eslint-plugin-github/lib/rules/prefer-observers.js
generated
vendored
|
|
@ -1,15 +1,15 @@
|
|||
const observerMap = {
|
||||
scroll: 'IntersectionObserver',
|
||||
resize: 'ResizeObserver'
|
||||
resize: 'ResizeObserver',
|
||||
}
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'disallow poorly performing event listeners',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -20,9 +20,9 @@ module.exports = {
|
|||
if (!(name.value in observerMap)) return
|
||||
context.report({
|
||||
node,
|
||||
message: `Avoid using "${name.value}" event listener. Consider using ${observerMap[name.value]} instead`
|
||||
message: `Avoid using "${name.value}" event listener. Consider using ${observerMap[name.value]} instead`,
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
18
node_modules/eslint-plugin-github/lib/rules/require-passive-events.js
generated
vendored
18
node_modules/eslint-plugin-github/lib/rules/require-passive-events.js
generated
vendored
|
|
@ -1,4 +1,12 @@
|
|||
const passiveEventListenerNames = new Set(['touchstart', 'touchmove', 'wheel', 'mousewheel'])
|
||||
const passiveEventListenerNames = new Set([
|
||||
'touchstart',
|
||||
'touchmove',
|
||||
'touchenter',
|
||||
'touchend',
|
||||
'touchleave',
|
||||
'wheel',
|
||||
'mousewheel',
|
||||
])
|
||||
|
||||
const propIsPassiveTrue = prop => prop.key && prop.key.name === 'passive' && prop.value && prop.value.value === true
|
||||
|
||||
|
|
@ -7,9 +15,9 @@ module.exports = {
|
|||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'enforce marking high frequency event handlers as passive',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -21,7 +29,7 @@ module.exports = {
|
|||
if (!passiveEventListenerNames.has(name.value)) return
|
||||
if (options && options.type === 'ObjectExpression' && options.properties.some(propIsPassiveTrue)) return
|
||||
context.report({node, message: `High Frequency Events like "${name.value}" should be \`passive: true\``})
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
101
node_modules/eslint-plugin-github/lib/rules/role-supports-aria-props.js
generated
vendored
Normal file
101
node_modules/eslint-plugin-github/lib/rules/role-supports-aria-props.js
generated
vendored
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
// @ts-check
|
||||
const {aria, elementRoles, roles} = require('aria-query')
|
||||
const {getProp, getPropValue, propName} = require('jsx-ast-utils')
|
||||
const {getElementType} = require('../utils/get-element-type')
|
||||
const ObjectMap = require('../utils/object-map')
|
||||
|
||||
// Clean-up `elementRoles` from `aria-query`
|
||||
const elementRolesMap = new ObjectMap()
|
||||
for (const [key, value] of elementRoles.entries()) {
|
||||
// - Remove unused `constraints` key
|
||||
delete key.constraints
|
||||
key.attributes = key.attributes?.filter(attribute => !('constraints' in attribute))
|
||||
// - Remove empty `attributes` key
|
||||
if (!key.attributes || key.attributes?.length === 0) {
|
||||
delete key.attributes
|
||||
}
|
||||
elementRolesMap.set(key, value)
|
||||
}
|
||||
// - Remove insufficiently-disambiguated `menuitem` entry
|
||||
elementRolesMap.delete({name: 'menuitem'})
|
||||
// - Disambiguate `menuitem` and `menu` roles by `type`
|
||||
elementRolesMap.set({name: 'menuitem', attributes: [{name: 'type', value: 'command'}]}, ['menuitem'])
|
||||
elementRolesMap.set({name: 'menuitem', attributes: [{name: 'type', value: 'radio'}]}, ['menuitemradio'])
|
||||
elementRolesMap.set({name: 'menuitem', attributes: [{name: 'type', value: 'toolbar'}]}, ['toolbar'])
|
||||
elementRolesMap.set({name: 'menu', attributes: [{name: 'type', value: 'toolbar'}]}, ['toolbar'])
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
docs: {
|
||||
description:
|
||||
'Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`.',
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
JSXOpeningElement(node) {
|
||||
// Assemble a key for looking-up the element’s role in the `elementRolesMap`
|
||||
// - Get the element’s name
|
||||
const key = {name: getElementType(context, node)}
|
||||
// - Get the element’s disambiguating attributes
|
||||
for (const prop of ['aria-expanded', 'type', 'size', 'role', 'href', 'multiple', 'scope']) {
|
||||
// - Only provide `aria-expanded` when it’s required for disambiguation
|
||||
if (prop === 'aria-expanded' && key.name !== 'summary') continue
|
||||
const value = getPropValue(getProp(node.attributes, prop))
|
||||
if (value) {
|
||||
if (!('attributes' in key)) {
|
||||
key.attributes = []
|
||||
}
|
||||
if (prop === 'href') {
|
||||
key.attributes.push({name: prop})
|
||||
} else {
|
||||
key.attributes.push({name: prop, value})
|
||||
}
|
||||
}
|
||||
}
|
||||
// Get the element’s explicit or implicit role
|
||||
const role = getPropValue(getProp(node.attributes, 'role')) ?? elementRolesMap.get(key)?.[0]
|
||||
|
||||
// Return early if role could not be determined
|
||||
if (!role) return
|
||||
|
||||
// Get allowed ARIA attributes:
|
||||
// - From the role itself
|
||||
let allowedProps = Object.keys(roles.get(role)?.props || {})
|
||||
// - From parent roles
|
||||
for (const parentRole of roles.get(role)?.superClass.flat() ?? []) {
|
||||
allowedProps = allowedProps.concat(Object.keys(roles.get(parentRole)?.props || {}))
|
||||
}
|
||||
// Dedupe, for performance
|
||||
allowedProps = Array.from(new Set(allowedProps))
|
||||
|
||||
// Get prohibited ARIA attributes:
|
||||
// - From the role itself
|
||||
let prohibitedProps = roles.get(role)?.prohibitedProps || []
|
||||
// - From parent roles
|
||||
for (const parentRole of roles.get(role)?.superClass.flat() ?? []) {
|
||||
prohibitedProps = prohibitedProps.concat(roles.get(parentRole)?.prohibitedProps || [])
|
||||
}
|
||||
// - From comparing allowed vs all ARIA attributes
|
||||
prohibitedProps = prohibitedProps.concat(aria.keys().filter(x => !allowedProps.includes(x)))
|
||||
// Dedupe, for performance
|
||||
prohibitedProps = Array.from(new Set(prohibitedProps))
|
||||
|
||||
for (const prop of node.attributes) {
|
||||
// Return early if prohibited ARIA attribute is set to an ignorable value
|
||||
if (getPropValue(prop) == null || prop.type === 'JSXSpreadAttribute') return
|
||||
|
||||
if (prohibitedProps?.includes(propName(prop))) {
|
||||
context.report({
|
||||
node,
|
||||
message: `The attribute ${propName(prop)} is not supported by the role ${role}.`,
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
12
node_modules/eslint-plugin-github/lib/rules/unescaped-html-literal.js
generated
vendored
12
node_modules/eslint-plugin-github/lib/rules/unescaped-html-literal.js
generated
vendored
|
|
@ -3,9 +3,9 @@ module.exports = {
|
|||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow unescaped HTML literals',
|
||||
url: require('../url')(module)
|
||||
url: require('../url')(module),
|
||||
},
|
||||
schema: []
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create(context) {
|
||||
|
|
@ -18,7 +18,7 @@ module.exports = {
|
|||
|
||||
context.report({
|
||||
node,
|
||||
message
|
||||
message,
|
||||
})
|
||||
},
|
||||
TemplateLiteral(node) {
|
||||
|
|
@ -27,10 +27,10 @@ module.exports = {
|
|||
if (!node.parent.tag || node.parent.tag.name !== 'html') {
|
||||
context.report({
|
||||
node,
|
||||
message
|
||||
message,
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
58
node_modules/eslint-plugin-github/lib/utils/object-map.js
generated
vendored
Normal file
58
node_modules/eslint-plugin-github/lib/utils/object-map.js
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
// @ts-check
|
||||
const {isDeepStrictEqual} = require('util')
|
||||
|
||||
/**
|
||||
* ObjectMap extends Map, but determines key equality using Node.js’ `util.isDeepStrictEqual` rather than using [SameValueZero](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#key_equality). This makes using objects as keys a bit simpler.
|
||||
*/
|
||||
module.exports = class ObjectMap extends Map {
|
||||
#data
|
||||
|
||||
constructor(iterable = []) {
|
||||
super()
|
||||
this.#data = iterable
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.#data = []
|
||||
}
|
||||
|
||||
delete(key) {
|
||||
if (!this.has(key)) {
|
||||
return false
|
||||
}
|
||||
this.#data = this.#data.filter(([existingKey]) => !isDeepStrictEqual(existingKey, key))
|
||||
return true
|
||||
}
|
||||
|
||||
entries() {
|
||||
return this.#data[Symbol.iterator]()
|
||||
}
|
||||
|
||||
forEach(cb) {
|
||||
for (const [key, value] of this.#data) {
|
||||
cb(value, key, this.#data)
|
||||
}
|
||||
}
|
||||
|
||||
get(key) {
|
||||
return this.#data.find(([existingKey]) => isDeepStrictEqual(existingKey, key))?.[1]
|
||||
}
|
||||
|
||||
has(key) {
|
||||
return this.#data.findIndex(([existingKey]) => isDeepStrictEqual(existingKey, key)) !== -1
|
||||
}
|
||||
|
||||
keys() {
|
||||
return this.#data.map(([key]) => key)[Symbol.iterator]()
|
||||
}
|
||||
|
||||
set(key, value) {
|
||||
this.delete(key)
|
||||
this.#data.push([key, value])
|
||||
return this
|
||||
}
|
||||
|
||||
values() {
|
||||
return this.#data.map(([, value]) => value)[Symbol.iterator]()
|
||||
}
|
||||
}
|
||||
21
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/LICENSE
generated
vendored
Normal file
21
node_modules/eslint-plugin-github/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.
|
||||
10
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/README.md
generated
vendored
Normal file
10
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# `@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.
|
||||
182
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js
generated
vendored
Normal file
182
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js
generated
vendored
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// 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/ban-types': 'error',
|
||||
'block-spacing': 'off',
|
||||
'@typescript-eslint/block-spacing': 'error',
|
||||
'brace-style': 'off',
|
||||
'@typescript-eslint/brace-style': 'error',
|
||||
'@typescript-eslint/class-literal-property-style': 'error',
|
||||
'comma-dangle': 'off',
|
||||
'@typescript-eslint/comma-dangle': 'error',
|
||||
'comma-spacing': 'off',
|
||||
'@typescript-eslint/comma-spacing': '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/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',
|
||||
'func-call-spacing': 'off',
|
||||
'@typescript-eslint/func-call-spacing': 'error',
|
||||
indent: 'off',
|
||||
'@typescript-eslint/indent': 'error',
|
||||
'init-declarations': 'off',
|
||||
'@typescript-eslint/init-declarations': 'error',
|
||||
'key-spacing': 'off',
|
||||
'@typescript-eslint/key-spacing': 'error',
|
||||
'keyword-spacing': 'off',
|
||||
'@typescript-eslint/keyword-spacing': 'error',
|
||||
'lines-around-comment': 'off',
|
||||
'@typescript-eslint/lines-around-comment': 'error',
|
||||
'lines-between-class-members': 'off',
|
||||
'@typescript-eslint/lines-between-class-members': 'error',
|
||||
'@typescript-eslint/member-delimiter-style': '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-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-interface': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
||||
'no-extra-parens': 'off',
|
||||
'@typescript-eslint/no-extra-parens': 'error',
|
||||
'no-extra-semi': 'off',
|
||||
'@typescript-eslint/no-extra-semi': '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-loss-of-precision': 'off',
|
||||
'@typescript-eslint/no-loss-of-precision': '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',
|
||||
'no-shadow': 'off',
|
||||
'@typescript-eslint/no-shadow': 'error',
|
||||
'@typescript-eslint/no-this-alias': 'error',
|
||||
'no-throw-literal': 'off',
|
||||
'@typescript-eslint/no-throw-literal': 'error',
|
||||
'@typescript-eslint/no-type-alias': 'error',
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'error',
|
||||
'@typescript-eslint/no-unnecessary-qualifier': '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-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-member-access': 'error',
|
||||
'@typescript-eslint/no-unsafe-return': '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-var-requires': 'error',
|
||||
'@typescript-eslint/non-nullable-type-assertion-style': 'error',
|
||||
'object-curly-spacing': 'off',
|
||||
'@typescript-eslint/object-curly-spacing': 'error',
|
||||
'padding-line-between-statements': 'off',
|
||||
'@typescript-eslint/padding-line-between-statements': 'error',
|
||||
'@typescript-eslint/parameter-properties': 'error',
|
||||
'@typescript-eslint/prefer-as-const': 'error',
|
||||
'@typescript-eslint/prefer-enum-initializers': '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',
|
||||
'@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/prefer-ts-expect-error': 'error',
|
||||
'@typescript-eslint/promise-function-async': 'error',
|
||||
quotes: 'off',
|
||||
'@typescript-eslint/quotes': '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',
|
||||
semi: 'off',
|
||||
'@typescript-eslint/semi': 'error',
|
||||
'@typescript-eslint/sort-type-constituents': 'error',
|
||||
'space-before-blocks': 'off',
|
||||
'@typescript-eslint/space-before-blocks': 'error',
|
||||
'space-before-function-paren': 'off',
|
||||
'@typescript-eslint/space-before-function-paren': 'error',
|
||||
'space-infix-ops': 'off',
|
||||
'@typescript-eslint/space-infix-ops': 'error',
|
||||
'@typescript-eslint/strict-boolean-expressions': 'error',
|
||||
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
||||
'@typescript-eslint/triple-slash-reference': 'error',
|
||||
'@typescript-eslint/type-annotation-spacing': 'error',
|
||||
'@typescript-eslint/typedef': 'error',
|
||||
'@typescript-eslint/unbound-method': 'error',
|
||||
'@typescript-eslint/unified-signatures': 'error',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=all.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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,oDAAoD;AAEpD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,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8CAA8C,EAAE,OAAO;QACvD,0CAA0C,EAAE,OAAO;QACnD,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,2CAA2C,EAAE,OAAO;QACpD,MAAM,EAAE,KAAK;QACb,2BAA2B,EAAE,OAAO;QACpC,+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,IAAI,EAAE,KAAK;QACX,yBAAyB,EAAE,OAAO;QAClC,2CAA2C,EAAE,OAAO;QACpD,qBAAqB,EAAE,KAAK;QAC5B,wCAAwC,EAAE,OAAO;QACjD,6BAA6B,EAAE,KAAK;QACpC,gDAAgD,EAAE,OAAO;QACzD,iBAAiB,EAAE,KAAK;QACxB,oCAAoC,EAAE,OAAO;QAC7C,+CAA+C,EAAE,OAAO;QACxD,gDAAgD,EAAE,OAAO;QACzD,2CAA2C,EAAE,OAAO;QACpD,4CAA4C,EAAE,OAAO;QACrD,4BAA4B,EAAE,OAAO;QACrC,mCAAmC,EAAE,OAAO;QAC5C,uCAAuC,EAAE,OAAO;KACjD;CACF,CAAC"}
|
||||
10
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/base.js
generated
vendored
Normal file
10
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/base.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// YOU CAN REGENERATE IT USING yarn generate:configs
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: { sourceType: 'module' },
|
||||
plugins: ['@typescript-eslint'],
|
||||
};
|
||||
//# sourceMappingURL=base.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/base.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,oDAAoD;AAEpD,iBAAS;IACP,MAAM,EAAE,2BAA2B;IACnC,aAAa,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;IACvC,OAAO,EAAE,CAAC,oBAAoB,CAAC;CAChC,CAAC"}
|
||||
32
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended.js
generated
vendored
Normal file
32
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended.js
generated
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
"use strict";
|
||||
module.exports = {
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
|
||||
rules: {
|
||||
'constructor-super': 'off',
|
||||
'getter-return': 'off',
|
||||
'no-const-assign': 'off',
|
||||
'no-dupe-args': 'off',
|
||||
'no-dupe-class-members': 'off',
|
||||
'no-dupe-keys': 'off',
|
||||
'no-func-assign': 'off',
|
||||
'no-import-assign': 'off',
|
||||
'no-new-symbol': 'off',
|
||||
'no-obj-calls': 'off',
|
||||
'no-redeclare': 'off',
|
||||
'no-setter-return': 'off',
|
||||
'no-this-before-super': 'off',
|
||||
'no-undef': 'off',
|
||||
'no-unreachable': 'off',
|
||||
'no-unsafe-negation': 'off',
|
||||
'no-var': 'error',
|
||||
'prefer-const': 'error',
|
||||
'prefer-rest-params': 'error',
|
||||
'prefer-spread': 'error',
|
||||
'valid-typeof': 'off', // ts(2367)
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
//# sourceMappingURL=eslint-recommended.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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":";AAKA,iBAAS;IACP,SAAS,EAAE;QACT;YACE,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;YAC1C,KAAK,EAAE;gBACL,mBAAmB,EAAE,KAAK;gBAC1B,eAAe,EAAE,KAAK;gBACtB,iBAAiB,EAAE,KAAK;gBACxB,cAAc,EAAE,KAAK;gBACrB,uBAAuB,EAAE,KAAK;gBAC9B,cAAc,EAAE,KAAK;gBACrB,gBAAgB,EAAE,KAAK;gBACvB,kBAAkB,EAAE,KAAK;gBACzB,eAAe,EAAE,KAAK;gBACtB,cAAc,EAAE,KAAK;gBACrB,cAAc,EAAE,KAAK;gBACrB,kBAAkB,EAAE,KAAK;gBACzB,sBAAsB,EAAE,KAAK;gBAC7B,UAAU,EAAE,KAAK;gBACjB,gBAAgB,EAAE,KAAK;gBACvB,oBAAoB,EAAE,KAAK;gBAC3B,QAAQ,EAAE,OAAO;gBACjB,cAAc,EAAE,OAAO;gBACvB,oBAAoB,EAAE,OAAO;gBAC7B,eAAe,EAAE,OAAO;gBACxB,cAAc,EAAE,KAAK,EAAE,WAAW;aACnC;SACF;KACF;CACF,CAAC"}
|
||||
27
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended-requiring-type-checking.js
generated
vendored
Normal file
27
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended-requiring-type-checking.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// 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-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-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-member-access': 'error',
|
||||
'@typescript-eslint/no-unsafe-return': '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-requiring-type-checking.js.map
|
||||
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"recommended-requiring-type-checking.js","sourceRoot":"","sources":["../../src/configs/recommended-requiring-type-checking.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,gCAAgC;AAChC,oDAAoD;AAEpD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,mCAAmC,EAAE,OAAO;QAC5C,yCAAyC,EAAE,OAAO;QAClD,oCAAoC,EAAE,OAAO;QAC7C,iBAAiB,EAAE,KAAK;QACxB,oCAAoC,EAAE,OAAO;QAC7C,wCAAwC,EAAE,OAAO;QACjD,kDAAkD,EAAE,OAAO;QAC3D,uCAAuC,EAAE,OAAO;QAChD,yCAAyC,EAAE,OAAO;QAClD,mCAAmC,EAAE,OAAO;QAC5C,4CAA4C,EAAE,OAAO;QACrD,qCAAqC,EAAE,OAAO;QAC9C,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,OAAO;QAC3C,2CAA2C,EAAE,OAAO;QACpD,kDAAkD,EAAE,OAAO;QAC3D,mCAAmC,EAAE,OAAO;KAC7C;CACF,CAAC"}
|
||||
37
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended.js
generated
vendored
Normal file
37
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended.js
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// 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/ban-ts-comment': 'error',
|
||||
'@typescript-eslint/ban-types': 'error',
|
||||
'no-array-constructor': 'off',
|
||||
'@typescript-eslint/no-array-constructor': 'error',
|
||||
'no-empty-function': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'error',
|
||||
'@typescript-eslint/no-empty-interface': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'warn',
|
||||
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
||||
'no-extra-semi': 'off',
|
||||
'@typescript-eslint/no-extra-semi': 'error',
|
||||
'@typescript-eslint/no-inferrable-types': 'error',
|
||||
'no-loss-of-precision': 'off',
|
||||
'@typescript-eslint/no-loss-of-precision': 'error',
|
||||
'@typescript-eslint/no-misused-new': 'error',
|
||||
'@typescript-eslint/no-namespace': 'error',
|
||||
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
||||
'@typescript-eslint/no-non-null-assertion': 'warn',
|
||||
'@typescript-eslint/no-this-alias': 'error',
|
||||
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': 'warn',
|
||||
'@typescript-eslint/no-var-requires': '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/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/recommended.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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,oDAAoD;AAEpD,iBAAS;IACP,OAAO,EAAE,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAC3D,KAAK,EAAE;QACL,iDAAiD,EAAE,OAAO;QAC1D,mCAAmC,EAAE,OAAO;QAC5C,8BAA8B,EAAE,OAAO;QACvC,sBAAsB,EAAE,KAAK;QAC7B,yCAAyC,EAAE,OAAO;QAClD,mBAAmB,EAAE,KAAK;QAC1B,sCAAsC,EAAE,OAAO;QAC/C,uCAAuC,EAAE,OAAO;QAChD,oCAAoC,EAAE,MAAM;QAC5C,gDAAgD,EAAE,OAAO;QACzD,eAAe,EAAE,KAAK;QACtB,kCAAkC,EAAE,OAAO;QAC3C,wCAAwC,EAAE,OAAO;QACjD,sBAAsB,EAAE,KAAK;QAC7B,yCAAyC,EAAE,OAAO;QAClD,mCAAmC,EAAE,OAAO;QAC5C,iCAAiC,EAAE,OAAO;QAC1C,wDAAwD,EAAE,OAAO;QACjE,0CAA0C,EAAE,MAAM;QAClD,kCAAkC,EAAE,OAAO;QAC3C,mDAAmD,EAAE,OAAO;QAC5D,gBAAgB,EAAE,KAAK;QACvB,mCAAmC,EAAE,MAAM;QAC3C,oCAAoC,EAAE,OAAO;QAC7C,oCAAoC,EAAE,OAAO;QAC7C,6CAA6C,EAAE,OAAO;QACtD,2CAA2C,EAAE,OAAO;KACrD;CACF,CAAC"}
|
||||
49
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js
generated
vendored
Normal file
49
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"use strict";
|
||||
// THIS CODE WAS AUTOMATICALLY GENERATED
|
||||
// DO NOT EDIT THIS CODE BY HAND
|
||||
// YOU CAN REGENERATE IT USING yarn generate:configs
|
||||
module.exports = {
|
||||
extends: ['./configs/base', './configs/eslint-recommended'],
|
||||
rules: {
|
||||
'@typescript-eslint/array-type': 'warn',
|
||||
'@typescript-eslint/ban-tslint-comment': 'warn',
|
||||
'@typescript-eslint/class-literal-property-style': 'warn',
|
||||
'@typescript-eslint/consistent-generic-constructors': 'warn',
|
||||
'@typescript-eslint/consistent-indexed-object-style': 'warn',
|
||||
'@typescript-eslint/consistent-type-assertions': 'warn',
|
||||
'@typescript-eslint/consistent-type-definitions': 'warn',
|
||||
'dot-notation': 'off',
|
||||
'@typescript-eslint/dot-notation': 'warn',
|
||||
'@typescript-eslint/no-base-to-string': 'warn',
|
||||
'@typescript-eslint/no-confusing-non-null-assertion': 'warn',
|
||||
'@typescript-eslint/no-duplicate-enum-values': 'warn',
|
||||
'@typescript-eslint/no-dynamic-delete': 'warn',
|
||||
'@typescript-eslint/no-extraneous-class': 'warn',
|
||||
'@typescript-eslint/no-invalid-void-type': 'warn',
|
||||
'@typescript-eslint/no-meaningless-void-operator': 'warn',
|
||||
'@typescript-eslint/no-mixed-enums': 'warn',
|
||||
'@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'warn',
|
||||
'no-throw-literal': 'off',
|
||||
'@typescript-eslint/no-throw-literal': 'warn',
|
||||
'@typescript-eslint/no-unnecessary-boolean-literal-compare': 'warn',
|
||||
'@typescript-eslint/no-unnecessary-condition': 'warn',
|
||||
'@typescript-eslint/no-unnecessary-type-arguments': 'warn',
|
||||
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
|
||||
'@typescript-eslint/no-unsafe-enum-comparison': 'warn',
|
||||
'no-useless-constructor': 'off',
|
||||
'@typescript-eslint/no-useless-constructor': 'warn',
|
||||
'@typescript-eslint/non-nullable-type-assertion-style': 'warn',
|
||||
'@typescript-eslint/prefer-for-of': 'warn',
|
||||
'@typescript-eslint/prefer-function-type': 'warn',
|
||||
'@typescript-eslint/prefer-includes': 'warn',
|
||||
'@typescript-eslint/prefer-literal-enum-member': 'warn',
|
||||
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
|
||||
'@typescript-eslint/prefer-optional-chain': 'warn',
|
||||
'@typescript-eslint/prefer-reduce-type-parameter': 'warn',
|
||||
'@typescript-eslint/prefer-return-this-type': 'warn',
|
||||
'@typescript-eslint/prefer-string-starts-ends-with': 'warn',
|
||||
'@typescript-eslint/prefer-ts-expect-error': 'warn',
|
||||
'@typescript-eslint/unified-signatures': 'warn',
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=strict.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"strict.js","sourceRoot":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|
||||
23
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/index.js
generated
vendored
Normal file
23
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
"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 eslint_recommended_1 = __importDefault(require("./configs/eslint-recommended"));
|
||||
const recommended_1 = __importDefault(require("./configs/recommended"));
|
||||
const recommended_requiring_type_checking_1 = __importDefault(require("./configs/recommended-requiring-type-checking"));
|
||||
const strict_1 = __importDefault(require("./configs/strict"));
|
||||
const rules_1 = __importDefault(require("./rules"));
|
||||
module.exports = {
|
||||
rules: rules_1.default,
|
||||
configs: {
|
||||
all: all_1.default,
|
||||
base: base_1.default,
|
||||
recommended: recommended_1.default,
|
||||
'eslint-recommended': eslint_recommended_1.default,
|
||||
'recommended-requiring-type-checking': recommended_requiring_type_checking_1.default,
|
||||
strict: strict_1.default,
|
||||
},
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/index.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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":";;;;AAAA,wDAAgC;AAChC,0DAAkC;AAClC,sFAA6D;AAC7D,wEAAgD;AAChD,wHAA6F;AAC7F,8DAAsC;AACtC,oDAA4B;AAE5B,iBAAS;IACP,KAAK,EAAL,eAAK;IACL,OAAO,EAAE;QACP,GAAG,EAAH,aAAG;QACH,IAAI,EAAJ,cAAI;QACJ,WAAW,EAAX,qBAAW;QACX,oBAAoB,EAAE,4BAAiB;QACvC,qCAAqC,EAAE,6CAAgC;QACvE,MAAM,EAAN,gBAAM;KACP;CACF,CAAC"}
|
||||
160
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js
generated
vendored
Normal file
160
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js
generated
vendored
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
"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 util = __importStar(require("../util"));
|
||||
exports.default = util.createRule({
|
||||
name: 'adjacent-overload-signatures',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Require that function overload signatures be consecutive',
|
||||
recommended: 'error',
|
||||
},
|
||||
schema: [],
|
||||
messages: {
|
||||
adjacentSignature: 'All {{name}} signatures should be adjacent.',
|
||||
},
|
||||
},
|
||||
defaultOptions: [],
|
||||
create(context) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
/**
|
||||
* 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) {
|
||||
var _a, _b;
|
||||
if (!member) {
|
||||
return null;
|
||||
}
|
||||
const isStatic = 'static' in member && !!member.static;
|
||||
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 = (_b = (_a = member.id) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : null;
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
name,
|
||||
static: isStatic,
|
||||
callSignature: false,
|
||||
type: util.MemberNameType.Normal,
|
||||
};
|
||||
}
|
||||
case utils_1.AST_NODE_TYPES.TSMethodSignature:
|
||||
return Object.assign(Object.assign({}, util.getNameFromMember(member, sourceCode)), { static: isStatic, callSignature: false });
|
||||
case utils_1.AST_NODE_TYPES.TSCallSignatureDeclaration:
|
||||
return {
|
||||
name: 'call',
|
||||
static: isStatic,
|
||||
callSignature: true,
|
||||
type: util.MemberNameType.Normal,
|
||||
};
|
||||
case utils_1.AST_NODE_TYPES.TSConstructSignatureDeclaration:
|
||||
return {
|
||||
name: 'new',
|
||||
static: isStatic,
|
||||
callSignature: false,
|
||||
type: util.MemberNameType.Normal,
|
||||
};
|
||||
case utils_1.AST_NODE_TYPES.MethodDefinition:
|
||||
return Object.assign(Object.assign({}, util.getNameFromMember(member, sourceCode)), { static: isStatic, 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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Check the body for overload methods.
|
||||
* @param {ASTNode} node the body to be inspected.
|
||||
*/
|
||||
function checkBodyForOverloadMethods(node) {
|
||||
const members = getMembers(node);
|
||||
if (members) {
|
||||
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/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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,8CAAgC;AAchC,kBAAe,IAAI,CAAC,UAAU,CAAC;IAC7B,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,0DAA0D;YACvE,WAAW,EAAE,OAAO;SACrB;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,iBAAiB,EAAE,6CAA6C;SACjE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAS3C;;;;WAIG;QACH,SAAS,eAAe,CAAC,MAAqB;;YAC5C,IAAI,CAAC,MAAM,EAAE;gBACX,OAAO,IAAI,CAAC;aACb;YAED,MAAM,QAAQ,GAAG,QAAQ,IAAI,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;YAEvD,QAAQ,MAAM,CAAC,IAAI,EAAE;gBACnB,KAAK,sBAAc,CAAC,wBAAwB,CAAC;gBAC7C,KAAK,sBAAc,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,yCAAyC;oBACzC,uCA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,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE;wBACnD,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI,EAAE,MAAM;4BACZ,SAAS,EAAE,mBAAmB;4BAC9B,IAAI,EAAE;gCACJ,IAAI,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,EAAE;6BACxD;yBACF,CAAC,CAAC;qBACJ;yBAAM,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;wBACvB,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;qBAC1B;oBAED,UAAU,GAAG,MAAM,CAAC;gBACtB,CAAC,CAAC,CAAC;aACJ;QACH,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"}
|
||||
249
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js
generated
vendored
Normal file
249
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js
generated
vendored
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
"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 util = __importStar(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 &&
|
||||
node.typeName.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
node.typeName.name === 'Array') {
|
||||
if (!node.typeParameters) {
|
||||
return true;
|
||||
}
|
||||
if (node.typeParameters.params.length === 1) {
|
||||
return isSimpleType(node.typeParameters.params[0]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (node.typeParameters) {
|
||||
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 = util.createRule({
|
||||
name: 'array-type',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Require consistently using either `T[]` or `Array<T>` for arrays',
|
||||
recommended: 'strict',
|
||||
},
|
||||
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.",
|
||||
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: {
|
||||
enum: ['array', 'generic', 'array-simple'],
|
||||
},
|
||||
},
|
||||
prefixItems: [
|
||||
{
|
||||
properties: {
|
||||
default: {
|
||||
$ref: '#/$defs/arrayOption',
|
||||
description: 'The array type expected for mutable cases...',
|
||||
},
|
||||
readonly: {
|
||||
$ref: '#/$defs/arrayOption',
|
||||
description: 'The array type expected for readonly cases. If omitted, the value for `default` will be used.',
|
||||
},
|
||||
},
|
||||
type: 'object',
|
||||
},
|
||||
],
|
||||
type: 'array',
|
||||
},
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
default: 'array',
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
var _a;
|
||||
const sourceCode = context.getSourceCode();
|
||||
const defaultOption = options.default;
|
||||
const readonlyOption = (_a = options.readonly) !== null && _a !== void 0 ? _a : defaultOption;
|
||||
/**
|
||||
* @param node the node to be evaluated.
|
||||
*/
|
||||
function getMessageType(node) {
|
||||
if (node && isSimpleType(node)) {
|
||||
return sourceCode.getText(node);
|
||||
}
|
||||
return 'T';
|
||||
}
|
||||
return {
|
||||
TSArrayType(node) {
|
||||
const isReadonly = node.parent &&
|
||||
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) {
|
||||
var _a, _b;
|
||||
if (node.typeName.type !== utils_1.AST_NODE_TYPES.Identifier ||
|
||||
!(node.typeName.name === 'Array' ||
|
||||
node.typeName.name === 'ReadonlyArray')) {
|
||||
return;
|
||||
}
|
||||
const isReadonlyArrayType = node.typeName.name === 'ReadonlyArray';
|
||||
const currentOption = isReadonlyArrayType
|
||||
? readonlyOption
|
||||
: defaultOption;
|
||||
if (currentOption === 'generic') {
|
||||
return;
|
||||
}
|
||||
const readonlyPrefix = isReadonlyArrayType ? 'readonly ' : '';
|
||||
const typeParams = (_a = node.typeParameters) === null || _a === void 0 ? void 0 : _a.params;
|
||||
const messageId = currentOption === 'array'
|
||||
? '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 &&
|
||||
((_b = node.parent) === null || _b === void 0 ? void 0 : _b.type) === utils_1.AST_NODE_TYPES.TSArrayType &&
|
||||
!util.isParenthesized(node.parent.elementType, sourceCode);
|
||||
const start = `${parentParens ? '(' : ''}${readonlyPrefix}${typeParens ? '(' : ''}`;
|
||||
const end = `${typeParens ? ')' : ''}[]${parentParens ? ')' : ''}`;
|
||||
context.report({
|
||||
node,
|
||||
messageId,
|
||||
data: {
|
||||
className: isReadonlyArrayType ? 'ReadonlyArray' : '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/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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
62
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js
generated
vendored
Normal file
62
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js
generated
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
"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("tsutils"));
|
||||
const util = __importStar(require("../util"));
|
||||
exports.default = util.createRule({
|
||||
name: 'await-thenable',
|
||||
meta: {
|
||||
docs: {
|
||||
description: 'Disallow awaiting a value that is not a Thenable',
|
||||
recommended: 'error',
|
||||
requiresTypeChecking: true,
|
||||
},
|
||||
messages: {
|
||||
await: 'Unexpected `await` of a non-Promise (non-"Thenable") value.',
|
||||
},
|
||||
schema: [],
|
||||
type: 'problem',
|
||||
},
|
||||
defaultOptions: [],
|
||||
create(context) {
|
||||
const parserServices = util.getParserServices(context);
|
||||
const checker = parserServices.program.getTypeChecker();
|
||||
return {
|
||||
AwaitExpression(node) {
|
||||
const originalNode = parserServices.esTreeNodeToTSNodeMap.get(node);
|
||||
const type = checker.getTypeAtLocation(originalNode.expression);
|
||||
if (!util.isTypeAnyType(type) &&
|
||||
!util.isTypeUnknownType(type) &&
|
||||
!tsutils.isThenableType(checker, originalNode.expression, type)) {
|
||||
context.report({
|
||||
messageId: 'await',
|
||||
node,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=await-thenable.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/await-thenable.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AAEnC,8CAAgC;AAEhC,kBAAe,IAAI,CAAC,UAAU,CAAC;IAC7B,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,kDAAkD;YAC/D,WAAW,EAAE,OAAO;YACpB,oBAAoB,EAAE,IAAI;SAC3B;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,6DAA6D;SACrE;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;KAChB;IACD,cAAc,EAAE,EAAE;IAElB,MAAM,CAAC,OAAO;QACZ,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAExD,OAAO;YACL,eAAe,CAAC,IAAI;gBAClB,MAAM,YAAY,GAAG,cAAc,CAAC,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACpE,MAAM,IAAI,GAAG,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;gBAEhE,IACE,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;oBACzB,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;oBAC7B,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,EAC/D;oBACA,OAAO,CAAC,MAAM,CAAC;wBACb,SAAS,EAAE,OAAO;wBAClB,IAAI;qBACL,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
158
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js
generated
vendored
Normal file
158
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js
generated
vendored
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
"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.defaultMinimumDescriptionLength = void 0;
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util = __importStar(require("../util"));
|
||||
exports.defaultMinimumDescriptionLength = 3;
|
||||
exports.default = util.createRule({
|
||||
name: 'ban-ts-comment',
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Disallow `@ts-<directive>` comments or require descriptions after directives',
|
||||
recommended: 'error',
|
||||
},
|
||||
messages: {
|
||||
tsDirectiveComment: 'Do not use "@ts-{{directive}}" because it alters compilation errors.',
|
||||
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.',
|
||||
},
|
||||
schema: {
|
||||
$defs: {
|
||||
directiveConfigSchema: {
|
||||
oneOf: [
|
||||
{
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
enum: ['allow-with-description'],
|
||||
},
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
descriptionFormat: { type: 'string' },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
prefixItems: [
|
||||
{
|
||||
properties: {
|
||||
'ts-expect-error': {
|
||||
$ref: '#/$defs/directiveConfigSchema',
|
||||
},
|
||||
'ts-ignore': { $ref: '#/$defs/directiveConfigSchema' },
|
||||
'ts-nocheck': { $ref: '#/$defs/directiveConfigSchema' },
|
||||
'ts-check': { $ref: '#/$defs/directiveConfigSchema' },
|
||||
minimumDescriptionLength: {
|
||||
type: 'number',
|
||||
default: exports.defaultMinimumDescriptionLength,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
type: 'array',
|
||||
},
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
'ts-expect-error': 'allow-with-description',
|
||||
'ts-ignore': true,
|
||||
'ts-nocheck': true,
|
||||
'ts-check': false,
|
||||
minimumDescriptionLength: exports.defaultMinimumDescriptionLength,
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
/*
|
||||
The regex used are taken from the ones used in the official TypeScript repo -
|
||||
https://github.com/microsoft/TypeScript/blob/408c760fae66080104bc85c449282c2d207dfe8e/src/compiler/scanner.ts#L288-L296
|
||||
*/
|
||||
const commentDirectiveRegExSingleLine = /^\/*\s*@ts-(?<directive>expect-error|ignore|check|nocheck)(?<description>.*)/;
|
||||
const commentDirectiveRegExMultiLine = /^\s*(?:\/|\*)*\s*@ts-(?<directive>expect-error|ignore|check|nocheck)(?<description>.*)/;
|
||||
const sourceCode = context.getSourceCode();
|
||||
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));
|
||||
}
|
||||
}
|
||||
return {
|
||||
Program() {
|
||||
const comments = sourceCode.getAllComments();
|
||||
comments.forEach(comment => {
|
||||
const regExp = comment.type === utils_1.AST_TOKEN_TYPES.Line
|
||||
? commentDirectiveRegExSingleLine
|
||||
: commentDirectiveRegExMultiLine;
|
||||
const match = regExp.exec(comment.value);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
const { directive, description } = match.groups;
|
||||
const fullDirective = `ts-${directive}`;
|
||||
const option = options[fullDirective];
|
||||
if (option === true) {
|
||||
context.report({
|
||||
data: { directive },
|
||||
node: comment,
|
||||
messageId: 'tsDirectiveComment',
|
||||
});
|
||||
}
|
||||
if (option === 'allow-with-description' ||
|
||||
(typeof option === 'object' && option.descriptionFormat)) {
|
||||
const { minimumDescriptionLength = exports.defaultMinimumDescriptionLength, } = options;
|
||||
const format = descriptionFormats.get(fullDirective);
|
||||
if (util.getStringLength(description.trim()) <
|
||||
minimumDescriptionLength) {
|
||||
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/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAA2D;AAE3D,8CAAgC;AAenB,QAAA,+BAA+B,GAAG,CAAC,CAAC;AAOjD,kBAAe,IAAI,CAAC,UAAU,CAAwB;IACpD,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,8EAA8E;YAChF,WAAW,EAAE,OAAO;SACrB;QACD,QAAQ,EAAE;YACR,kBAAkB,EAChB,sEAAsE;YACxE,qCAAqC,EACnC,6LAA6L;YAC/L,4CAA4C,EAC1C,yFAAyF;SAC5F;QACD,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,qBAAqB,EAAE;oBACrB,KAAK,EAAE;wBACL;4BACE,IAAI,EAAE,SAAS;4BACf,OAAO,EAAE,IAAI;yBACd;wBACD;4BACE,IAAI,EAAE,CAAC,wBAAwB,CAAC;yBACjC;wBACD;4BACE,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACV,iBAAiB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;6BACtC;yBACF;qBACF;iBACF;aACF;YACD,WAAW,EAAE;gBACX;oBACE,UAAU,EAAE;wBACV,iBAAiB,EAAE;4BACjB,IAAI,EAAE,+BAA+B;yBACtC;wBACD,WAAW,EAAE,EAAE,IAAI,EAAE,+BAA+B,EAAE;wBACtD,YAAY,EAAE,EAAE,IAAI,EAAE,+BAA+B,EAAE;wBACvD,UAAU,EAAE,EA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L,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
78
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-tslint-comment.js
generated
vendored
Normal file
78
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-tslint-comment.js
generated
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
"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 util = __importStar(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 = util.createRule({
|
||||
name: 'ban-tslint-comment',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Disallow `// tslint:<rule-flag>` comments',
|
||||
recommended: 'strict',
|
||||
},
|
||||
messages: {
|
||||
commentDetected: 'tslint comment detected: "{{ text }}"',
|
||||
},
|
||||
schema: [],
|
||||
fixable: 'code',
|
||||
},
|
||||
defaultOptions: [],
|
||||
create: context => {
|
||||
const sourceCode = context.getSourceCode();
|
||||
return {
|
||||
Program() {
|
||||
const comments = 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 = sourceCode.getIndexFromLoc({
|
||||
column: c.loc.start.column > 0 ? c.loc.start.column - 1 : 0,
|
||||
line: c.loc.start.line,
|
||||
});
|
||||
const rangeEnd = 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/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-tslint-comment.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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,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AC,eAAe,CAAC;oCAC5C,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,UAAU,CAAC,eAAe,CAAC;oCAC1C,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;qBACJ;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
231
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-types.js
generated
vendored
Normal file
231
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
"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.TYPE_KEYWORDS = void 0;
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util = __importStar(require("../util"));
|
||||
function removeSpaces(str) {
|
||||
return str.replace(/\s/g, '');
|
||||
}
|
||||
function stringifyNode(node, sourceCode) {
|
||||
return removeSpaces(sourceCode.getText(node));
|
||||
}
|
||||
function getCustomMessage(bannedType) {
|
||||
if (bannedType == null) {
|
||||
return '';
|
||||
}
|
||||
if (typeof bannedType === 'string') {
|
||||
return ` ${bannedType}`;
|
||||
}
|
||||
if (bannedType.message) {
|
||||
return ` ${bannedType.message}`;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
const defaultTypes = {
|
||||
String: {
|
||||
message: 'Use string instead',
|
||||
fixWith: 'string',
|
||||
},
|
||||
Boolean: {
|
||||
message: 'Use boolean instead',
|
||||
fixWith: 'boolean',
|
||||
},
|
||||
Number: {
|
||||
message: 'Use number instead',
|
||||
fixWith: 'number',
|
||||
},
|
||||
Symbol: {
|
||||
message: 'Use symbol instead',
|
||||
fixWith: 'symbol',
|
||||
},
|
||||
BigInt: {
|
||||
message: 'Use bigint instead',
|
||||
fixWith: 'bigint',
|
||||
},
|
||||
Function: {
|
||||
message: [
|
||||
'The `Function` type accepts any function-like value.',
|
||||
'It provides no type safety when calling the function, which can be a common source of bugs.',
|
||||
'It also accepts things like class declarations, which will throw at runtime as they will not be called with `new`.',
|
||||
'If you are expecting the function to accept certain arguments, you should explicitly define the function shape.',
|
||||
].join('\n'),
|
||||
},
|
||||
// object typing
|
||||
Object: {
|
||||
message: [
|
||||
'The `Object` type actually means "any non-nullish value", so it is marginally better than `unknown`.',
|
||||
'- If you want a type meaning "any object", you probably want `object` instead.',
|
||||
'- If you want a type meaning "any value", you probably want `unknown` instead.',
|
||||
'- If you really want a type meaning "any non-nullish value", you probably want `NonNullable<unknown>` instead.',
|
||||
].join('\n'),
|
||||
suggest: ['object', 'unknown', 'NonNullable<unknown>'],
|
||||
},
|
||||
'{}': {
|
||||
message: [
|
||||
'`{}` actually means "any non-nullish value".',
|
||||
'- If you want a type meaning "any object", you probably want `object` instead.',
|
||||
'- If you want a type meaning "any value", you probably want `unknown` instead.',
|
||||
'- If you want a type meaning "empty object", you probably want `Record<string, never>` instead.',
|
||||
'- If you really want a type meaning "any non-nullish value", you probably want `NonNullable<unknown>` instead.',
|
||||
].join('\n'),
|
||||
suggest: [
|
||||
'object',
|
||||
'unknown',
|
||||
'Record<string, never>',
|
||||
'NonNullable<unknown>',
|
||||
],
|
||||
},
|
||||
};
|
||||
exports.TYPE_KEYWORDS = {
|
||||
bigint: utils_1.AST_NODE_TYPES.TSBigIntKeyword,
|
||||
boolean: utils_1.AST_NODE_TYPES.TSBooleanKeyword,
|
||||
never: utils_1.AST_NODE_TYPES.TSNeverKeyword,
|
||||
null: utils_1.AST_NODE_TYPES.TSNullKeyword,
|
||||
number: utils_1.AST_NODE_TYPES.TSNumberKeyword,
|
||||
object: utils_1.AST_NODE_TYPES.TSObjectKeyword,
|
||||
string: utils_1.AST_NODE_TYPES.TSStringKeyword,
|
||||
symbol: utils_1.AST_NODE_TYPES.TSSymbolKeyword,
|
||||
undefined: utils_1.AST_NODE_TYPES.TSUndefinedKeyword,
|
||||
unknown: utils_1.AST_NODE_TYPES.TSUnknownKeyword,
|
||||
void: utils_1.AST_NODE_TYPES.TSVoidKeyword,
|
||||
};
|
||||
exports.default = util.createRule({
|
||||
name: 'ban-types',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Disallow certain types',
|
||||
recommended: 'error',
|
||||
},
|
||||
fixable: 'code',
|
||||
hasSuggestions: true,
|
||||
messages: {
|
||||
bannedTypeMessage: "Don't use `{{name}}` as a type.{{customMessage}}",
|
||||
bannedTypeReplacement: 'Replace `{{name}}` with `{{replacement}}`.',
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
types: {
|
||||
type: 'object',
|
||||
additionalProperties: {
|
||||
oneOf: [
|
||||
{ type: 'null' },
|
||||
{ type: 'boolean' },
|
||||
{ type: 'string' },
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
message: { type: 'string' },
|
||||
fixWith: { type: 'string' },
|
||||
suggest: {
|
||||
type: 'array',
|
||||
items: { type: 'string' },
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
extendDefaults: {
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [{}],
|
||||
create(context, [options]) {
|
||||
var _a, _b;
|
||||
const extendDefaults = (_a = options.extendDefaults) !== null && _a !== void 0 ? _a : true;
|
||||
const customTypes = (_b = options.types) !== null && _b !== void 0 ? _b : {};
|
||||
const types = Object.assign({}, extendDefaults ? defaultTypes : {}, customTypes);
|
||||
const bannedTypes = new Map(Object.entries(types).map(([type, data]) => [removeSpaces(type), data]));
|
||||
function checkBannedTypes(typeNode, name = stringifyNode(typeNode, context.getSourceCode())) {
|
||||
const bannedType = bannedTypes.get(name);
|
||||
if (bannedType === undefined || bannedType === false) {
|
||||
return;
|
||||
}
|
||||
const customMessage = getCustomMessage(bannedType);
|
||||
const fixWith = bannedType && typeof bannedType === 'object' && bannedType.fixWith;
|
||||
const suggest = bannedType && typeof bannedType === 'object'
|
||||
? bannedType.suggest
|
||||
: undefined;
|
||||
context.report({
|
||||
node: typeNode,
|
||||
messageId: 'bannedTypeMessage',
|
||||
data: {
|
||||
name,
|
||||
customMessage,
|
||||
},
|
||||
fix: fixWith
|
||||
? (fixer) => fixer.replaceText(typeNode, fixWith)
|
||||
: null,
|
||||
suggest: suggest === null || suggest === void 0 ? void 0 : suggest.map(replacement => ({
|
||||
messageId: 'bannedTypeReplacement',
|
||||
data: {
|
||||
name,
|
||||
replacement,
|
||||
},
|
||||
fix: (fixer) => fixer.replaceText(typeNode, replacement),
|
||||
})),
|
||||
});
|
||||
}
|
||||
const keywordSelectors = util.objectReduceKey(exports.TYPE_KEYWORDS, (acc, keyword) => {
|
||||
if (bannedTypes.has(keyword)) {
|
||||
acc[exports.TYPE_KEYWORDS[keyword]] = (node) => checkBannedTypes(node, keyword);
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
return Object.assign(Object.assign({}, keywordSelectors), { TSTypeLiteral(node) {
|
||||
if (node.members.length) {
|
||||
return;
|
||||
}
|
||||
checkBannedTypes(node);
|
||||
},
|
||||
TSTupleType(node) {
|
||||
if (node.elementTypes.length === 0) {
|
||||
checkBannedTypes(node);
|
||||
}
|
||||
},
|
||||
TSTypeReference(node) {
|
||||
checkBannedTypes(node.typeName);
|
||||
if (node.typeParameters) {
|
||||
checkBannedTypes(node);
|
||||
}
|
||||
},
|
||||
TSInterfaceHeritage(node) {
|
||||
checkBannedTypes(node);
|
||||
},
|
||||
TSClassImplements(node) {
|
||||
checkBannedTypes(node);
|
||||
} });
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=ban-types.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-types.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-types.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
158
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/block-spacing.js
generated
vendored
Normal file
158
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/block-spacing.js
generated
vendored
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
"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 util = __importStar(require("../util"));
|
||||
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
|
||||
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('block-spacing');
|
||||
exports.default = util.createRule({
|
||||
name: 'block-spacing',
|
||||
meta: {
|
||||
type: 'layout',
|
||||
docs: {
|
||||
description: 'Disallow or enforce spaces inside of blocks after opening block and before closing block',
|
||||
recommended: false,
|
||||
extendsBaseRule: true,
|
||||
},
|
||||
fixable: 'whitespace',
|
||||
hasSuggestions: baseRule.meta.hasSuggestions,
|
||||
schema: baseRule.meta.schema,
|
||||
messages: baseRule.meta.messages,
|
||||
},
|
||||
defaultOptions: ['always'],
|
||||
create(context, [whenToApplyOption]) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
const baseRules = baseRule.create(context);
|
||||
const always = whenToApplyOption !== 'never';
|
||||
const messageId = always ? 'missing' : 'extra';
|
||||
/**
|
||||
* Gets the open brace token from a given node.
|
||||
* @returns The token of the open brace.
|
||||
*/
|
||||
function getOpenBrace(node) {
|
||||
// guaranteed for enums
|
||||
// This is the only change made here from the base rule
|
||||
return sourceCode.getFirstToken(node, {
|
||||
filter: token => token.type === utils_1.AST_TOKEN_TYPES.Punctuator && token.value === '{',
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Checks whether or not:
|
||||
* - given tokens are on same line.
|
||||
* - there is/isn't a space between given tokens.
|
||||
* @param left A token to check.
|
||||
* @param right The token which is next to `left`.
|
||||
* @returns
|
||||
* When the option is `"always"`, `true` if there are one or more spaces between given tokens.
|
||||
* When the option is `"never"`, `true` if there are not any spaces between given tokens.
|
||||
* If given tokens are not on same line, it's always `true`.
|
||||
*/
|
||||
function isValid(left, right) {
|
||||
return (!util.isTokenOnSameLine(left, right) ||
|
||||
sourceCode.isSpaceBetween(left, right) === always);
|
||||
}
|
||||
/**
|
||||
* Checks and reports invalid spacing style inside braces.
|
||||
*/
|
||||
function checkSpacingInsideBraces(node) {
|
||||
// Gets braces and the first/last token of content.
|
||||
const openBrace = getOpenBrace(node);
|
||||
const closeBrace = sourceCode.getLastToken(node);
|
||||
const firstToken = sourceCode.getTokenAfter(openBrace, {
|
||||
includeComments: true,
|
||||
});
|
||||
const lastToken = sourceCode.getTokenBefore(closeBrace, {
|
||||
includeComments: true,
|
||||
});
|
||||
// Skip if the node is invalid or empty.
|
||||
if (openBrace.type !== utils_1.AST_TOKEN_TYPES.Punctuator ||
|
||||
openBrace.value !== '{' ||
|
||||
closeBrace.type !== utils_1.AST_TOKEN_TYPES.Punctuator ||
|
||||
closeBrace.value !== '}' ||
|
||||
firstToken === closeBrace) {
|
||||
return;
|
||||
}
|
||||
// Skip line comments for option never
|
||||
if (!always && firstToken.type === utils_1.AST_TOKEN_TYPES.Line) {
|
||||
return;
|
||||
}
|
||||
if (!isValid(openBrace, firstToken)) {
|
||||
let loc = openBrace.loc;
|
||||
if (messageId === 'extra') {
|
||||
loc = {
|
||||
start: openBrace.loc.end,
|
||||
end: firstToken.loc.start,
|
||||
};
|
||||
}
|
||||
context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId,
|
||||
data: {
|
||||
location: 'after',
|
||||
token: openBrace.value,
|
||||
},
|
||||
fix(fixer) {
|
||||
if (always) {
|
||||
return fixer.insertTextBefore(firstToken, ' ');
|
||||
}
|
||||
return fixer.removeRange([openBrace.range[1], firstToken.range[0]]);
|
||||
},
|
||||
});
|
||||
}
|
||||
if (!isValid(lastToken, closeBrace)) {
|
||||
let loc = closeBrace.loc;
|
||||
if (messageId === 'extra') {
|
||||
loc = {
|
||||
start: lastToken.loc.end,
|
||||
end: closeBrace.loc.start,
|
||||
};
|
||||
}
|
||||
context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId,
|
||||
data: {
|
||||
location: 'before',
|
||||
token: closeBrace.value,
|
||||
},
|
||||
fix(fixer) {
|
||||
if (always) {
|
||||
return fixer.insertTextAfter(lastToken, ' ');
|
||||
}
|
||||
return fixer.removeRange([lastToken.range[1], closeBrace.range[0]]);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
return Object.assign(Object.assign({}, baseRules), {
|
||||
// This code worked "out of the box" for interface and type literal
|
||||
// Enums were very close to match as well, the only reason they are not is that was that enums don't have a body node in the parser
|
||||
// So the opening brace punctuator starts in the middle of the node - `getFirstToken` in
|
||||
// the base rule did not filter for the first opening brace punctuator
|
||||
TSInterfaceBody: baseRules.BlockStatement, TSTypeLiteral: baseRules.BlockStatement, TSEnumDeclaration: checkSpacingInsideBraces });
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=block-spacing.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/block-spacing.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/block-spacing.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"block-spacing.js","sourceRoot":"","sources":["../../src/rules/block-spacing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA2D;AAE3D,8CAAgC;AAChC,iEAA8D;AAE9D,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC,eAAe,CAAC,CAAC;AAKpD,kBAAe,IAAI,CAAC,UAAU,CAAsB;IAClD,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE;YACJ,WAAW,EACT,0FAA0F;YAC5F,WAAW,EAAE,KAAK;YAClB,eAAe,EAAE,IAAI;SACtB;QACD,OAAO,EAAE,YAAY;QACrB,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;IAE1B,MAAM,CAAC,OAAO,EAAE,CAAC,iBAAiB,CAAC;QACjC,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3C,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,MAAM,GAAG,iBAAiB,KAAK,OAAO,CAAC;QAC7C,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/C;;;WAGG;QACH,SAAS,YAAY,CACnB,IAAgC;YAEhC,uBAAuB;YACvB,uDAAuD;YACvD,OAAO,UAAU,CAAC,aAAa,CAAC,IAAI,EAAE;gBACpC,MAAM,E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,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACtE,CAAC;iBACF,CAAC,CAAC;aACJ;QACH,CAAC;QACD,uCACK,SAAS;YAEZ,mEAAmE;YACnE,mIAAmI;YACnI,wFAAwF;YACxF,sEAAsE;YACtE,eAAe,EAAE,SAAS,CAAC,cAAuB,EAClD,aAAa,EAAE,SAAS,CAAC,cAAuB,EAChD,iBAAiB,EAAE,wBAAwB,IAC3C;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
94
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/brace-style.js
generated
vendored
Normal file
94
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/brace-style.js
generated
vendored
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const util_1 = require("../util");
|
||||
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
|
||||
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('brace-style');
|
||||
exports.default = (0, util_1.createRule)({
|
||||
name: 'brace-style',
|
||||
meta: {
|
||||
type: 'layout',
|
||||
docs: {
|
||||
description: 'Enforce consistent brace style for blocks',
|
||||
recommended: false,
|
||||
extendsBaseRule: true,
|
||||
},
|
||||
messages: baseRule.meta.messages,
|
||||
fixable: baseRule.meta.fixable,
|
||||
hasSuggestions: baseRule.meta.hasSuggestions,
|
||||
schema: baseRule.meta.schema,
|
||||
},
|
||||
defaultOptions: ['1tbs'],
|
||||
create(context) {
|
||||
const [style, { allowSingleLine } = { allowSingleLine: false }] =
|
||||
// eslint-disable-next-line no-restricted-syntax -- Use raw options for extended rules.
|
||||
context.options;
|
||||
const isAllmanStyle = style === 'allman';
|
||||
const sourceCode = context.getSourceCode();
|
||||
const rules = baseRule.create(context);
|
||||
/**
|
||||
* Checks a pair of curly brackets based on the user's config
|
||||
*/
|
||||
function validateCurlyPair(openingCurlyToken, closingCurlyToken) {
|
||||
if (allowSingleLine &&
|
||||
(0, util_1.isTokenOnSameLine)(openingCurlyToken, closingCurlyToken)) {
|
||||
return;
|
||||
}
|
||||
const tokenBeforeOpeningCurly = sourceCode.getTokenBefore(openingCurlyToken);
|
||||
const tokenBeforeClosingCurly = sourceCode.getTokenBefore(closingCurlyToken);
|
||||
const tokenAfterOpeningCurly = sourceCode.getTokenAfter(openingCurlyToken);
|
||||
if (!isAllmanStyle &&
|
||||
!(0, util_1.isTokenOnSameLine)(tokenBeforeOpeningCurly, openingCurlyToken)) {
|
||||
context.report({
|
||||
node: openingCurlyToken,
|
||||
messageId: 'nextLineOpen',
|
||||
fix: fixer => {
|
||||
const textRange = [
|
||||
tokenBeforeOpeningCurly.range[1],
|
||||
openingCurlyToken.range[0],
|
||||
];
|
||||
const textBetween = sourceCode.text.slice(textRange[0], textRange[1]);
|
||||
if (textBetween.trim()) {
|
||||
return null;
|
||||
}
|
||||
return fixer.replaceTextRange(textRange, ' ');
|
||||
},
|
||||
});
|
||||
}
|
||||
if (isAllmanStyle &&
|
||||
(0, util_1.isTokenOnSameLine)(tokenBeforeOpeningCurly, openingCurlyToken)) {
|
||||
context.report({
|
||||
node: openingCurlyToken,
|
||||
messageId: 'sameLineOpen',
|
||||
fix: fixer => fixer.insertTextBefore(openingCurlyToken, '\n'),
|
||||
});
|
||||
}
|
||||
if ((0, util_1.isTokenOnSameLine)(openingCurlyToken, tokenAfterOpeningCurly) &&
|
||||
tokenAfterOpeningCurly !== closingCurlyToken) {
|
||||
context.report({
|
||||
node: openingCurlyToken,
|
||||
messageId: 'blockSameLine',
|
||||
fix: fixer => fixer.insertTextAfter(openingCurlyToken, '\n'),
|
||||
});
|
||||
}
|
||||
if ((0, util_1.isTokenOnSameLine)(tokenBeforeClosingCurly, closingCurlyToken) &&
|
||||
tokenBeforeClosingCurly !== openingCurlyToken) {
|
||||
context.report({
|
||||
node: closingCurlyToken,
|
||||
messageId: 'singleLineClose',
|
||||
fix: fixer => fixer.insertTextBefore(closingCurlyToken, '\n'),
|
||||
});
|
||||
}
|
||||
}
|
||||
return Object.assign(Object.assign({}, rules), { 'TSInterfaceBody, TSModuleBlock'(node) {
|
||||
const openingCurly = sourceCode.getFirstToken(node);
|
||||
const closingCurly = sourceCode.getLastToken(node);
|
||||
validateCurlyPair(openingCurly, closingCurly);
|
||||
},
|
||||
TSEnumDeclaration(node) {
|
||||
const closingCurly = sourceCode.getLastToken(node);
|
||||
const openingCurly = sourceCode.getTokenBefore(node.members.length ? node.members[0] : closingCurly);
|
||||
validateCurlyPair(openingCurly, closingCurly);
|
||||
} });
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=brace-style.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/brace-style.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/brace-style.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"brace-style.js","sourceRoot":"","sources":["../../src/rules/brace-style.ts"],"names":[],"mappings":";;AAMA,kCAAwD;AACxD,iEAA8D;AAE9D,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC,aAAa,CAAC,CAAC;AAKlD,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE;YACJ,WAAW,EAAE,2CAA2C;YACxD,WAAW,EAAE,KAAK;YAClB,eAAe,EAAE,IAAI;SACtB;QACD,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ;QAChC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO;QAC9B,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,cAAc;QAC5C,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM;KAC7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E,CAAC;gBAEpD,iBAAiB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;YAChD,CAAC;YACD,iBAAiB,CAAC,IAAI;gBACpB,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,IAAI,CAAE,CAAC;gBACpD,MAAM,YAAY,GAAG,UAAU,CAAC,cAAc,CAC5C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CACpD,CAAC;gBAEH,iBAAiB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;YAChD,CAAC,IACD;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
126
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-literal-property-style.js
generated
vendored
Normal file
126
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-literal-property-style.js
generated
vendored
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
"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 util = __importStar(require("../util"));
|
||||
const printNodeModifiers = (node, final) => {
|
||||
var _a;
|
||||
return `${(_a = node.accessibility) !== null && _a !== void 0 ? _a : ''}${node.static ? ' static' : ''} ${final} `.trimStart();
|
||||
};
|
||||
const isSupportedLiteral = (node) => {
|
||||
if (node.type === utils_1.AST_NODE_TYPES.Literal) {
|
||||
return true;
|
||||
}
|
||||
if (node.type === utils_1.AST_NODE_TYPES.TaggedTemplateExpression ||
|
||||
node.type === utils_1.AST_NODE_TYPES.TemplateLiteral) {
|
||||
return ('quasi' in node ? node.quasi.quasis : node.quasis).length === 1;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
exports.default = util.createRule({
|
||||
name: 'class-literal-property-style',
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Enforce that literals on classes are exposed in a consistent style',
|
||||
recommended: 'strict',
|
||||
},
|
||||
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: [{ enum: ['fields', 'getters'] }],
|
||||
},
|
||||
defaultOptions: ['fields'],
|
||||
create(context, [style]) {
|
||||
return Object.assign(Object.assign({}, (style === 'fields' && {
|
||||
MethodDefinition(node) {
|
||||
if (node.kind !== 'get' ||
|
||||
!node.value.body ||
|
||||
!node.value.body.body.length) {
|
||||
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;
|
||||
}
|
||||
context.report({
|
||||
node: node.key,
|
||||
messageId: 'preferFieldStyle',
|
||||
suggest: [
|
||||
{
|
||||
messageId: 'preferFieldStyleSuggestion',
|
||||
fix(fixer) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
const name = sourceCode.getText(node.key);
|
||||
let text = '';
|
||||
text += printNodeModifiers(node, 'readonly');
|
||||
text += node.computed ? `[${name}]` : name;
|
||||
text += ` = ${sourceCode.getText(argument)};`;
|
||||
return fixer.replaceText(node, text);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
})), (style === 'getters' && {
|
||||
PropertyDefinition(node) {
|
||||
if (!node.readonly || node.declare) {
|
||||
return;
|
||||
}
|
||||
const { value } = node;
|
||||
if (!value || !isSupportedLiteral(value)) {
|
||||
return;
|
||||
}
|
||||
context.report({
|
||||
node: node.key,
|
||||
messageId: 'preferGetterStyle',
|
||||
suggest: [
|
||||
{
|
||||
messageId: 'preferGetterStyleSuggestion',
|
||||
fix(fixer) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
const name = sourceCode.getText(node.key);
|
||||
let text = '';
|
||||
text += printNodeModifiers(node, 'get');
|
||||
text += node.computed ? `[${name}]` : name;
|
||||
text += `() { return ${sourceCode.getText(value)}; }`;
|
||||
return fixer.replaceText(node, text);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
}));
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=class-literal-property-style.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-literal-property-style.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/class-literal-property-style.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"class-literal-property-style.js","sourceRoot":"","sources":["../../src/rules/class-literal-property-style.ts"],"names":[],"mappings":";;;;;;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AAI,EAAE,IAAI,CAAC,CAAC;4BACvC,CAAC;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,GACC,CAAC,KAAK,KAAK,SAAS,IAAI;YACzB,kBAAkB,CAAC,IAAI;gBACrB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE;oBAClC,OAAO;iBACR;gBAED,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;gBAEvB,IAAI,CAAC,KAAK,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE;oBACxC,OAAO;iBACR;gBAED,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,EAAE,IAAI,CAAC,GAAG;oBACd,SAAS,EAAE,mBAAmB;oBAC9B,OAAO,EAAE;wBACP;4BACE,SAAS,EAAE,6BAA6B;4BACxC,GAAG,CAAC,KAAK;gCACP,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;gCAC3C,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gCAE1C,IAAI,IAAI,GAAG,EAAE,CAAC;gCAEd,IAAI,IAAI,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gCACxC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;gCAC3C,IAAI,IAAI,eAAe,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;gCAEtD,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;4BACvC,CAAC;yBACF;qBACF;iBACF,CAAC,CAAC;YACL,CAAC;SACF,CAAC,EACF;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
180
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-dangle.js
generated
vendored
Normal file
180
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-dangle.js
generated
vendored
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
"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 util = __importStar(require("../util"));
|
||||
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
|
||||
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('comma-dangle');
|
||||
const OPTION_VALUE_SCHEME = [
|
||||
'always-multiline',
|
||||
'always',
|
||||
'never',
|
||||
'only-multiline',
|
||||
];
|
||||
const DEFAULT_OPTION_VALUE = 'never';
|
||||
function normalizeOptions(options) {
|
||||
var _a, _b, _c;
|
||||
if (typeof options === 'string') {
|
||||
return {
|
||||
enums: options,
|
||||
generics: options,
|
||||
tuples: options,
|
||||
};
|
||||
}
|
||||
return {
|
||||
enums: (_a = options.enums) !== null && _a !== void 0 ? _a : DEFAULT_OPTION_VALUE,
|
||||
generics: (_b = options.generics) !== null && _b !== void 0 ? _b : DEFAULT_OPTION_VALUE,
|
||||
tuples: (_c = options.tuples) !== null && _c !== void 0 ? _c : DEFAULT_OPTION_VALUE,
|
||||
};
|
||||
}
|
||||
exports.default = util.createRule({
|
||||
name: 'comma-dangle',
|
||||
meta: {
|
||||
type: 'layout',
|
||||
docs: {
|
||||
description: 'Require or disallow trailing commas',
|
||||
recommended: false,
|
||||
extendsBaseRule: true,
|
||||
},
|
||||
schema: {
|
||||
$defs: {
|
||||
value: {
|
||||
enum: OPTION_VALUE_SCHEME,
|
||||
},
|
||||
valueWithIgnore: {
|
||||
enum: [...OPTION_VALUE_SCHEME, 'ignore'],
|
||||
},
|
||||
},
|
||||
type: 'array',
|
||||
items: [
|
||||
{
|
||||
oneOf: [
|
||||
{
|
||||
$ref: '#/$defs/value',
|
||||
},
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
arrays: { $ref: '#/$defs/valueWithIgnore' },
|
||||
objects: { $ref: '#/$defs/valueWithIgnore' },
|
||||
imports: { $ref: '#/$defs/valueWithIgnore' },
|
||||
exports: { $ref: '#/$defs/valueWithIgnore' },
|
||||
functions: { $ref: '#/$defs/valueWithIgnore' },
|
||||
enums: { $ref: '#/$defs/valueWithIgnore' },
|
||||
generics: { $ref: '#/$defs/valueWithIgnore' },
|
||||
tuples: { $ref: '#/$defs/valueWithIgnore' },
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
additionalProperties: false,
|
||||
},
|
||||
fixable: 'code',
|
||||
hasSuggestions: baseRule.meta.hasSuggestions,
|
||||
messages: baseRule.meta.messages,
|
||||
},
|
||||
defaultOptions: ['never'],
|
||||
create(context, [options]) {
|
||||
const rules = baseRule.create(context);
|
||||
const sourceCode = context.getSourceCode();
|
||||
const normalizedOptions = normalizeOptions(options);
|
||||
const predicate = {
|
||||
always: forceComma,
|
||||
'always-multiline': forceCommaIfMultiline,
|
||||
'only-multiline': allowCommaIfMultiline,
|
||||
never: forbidComma,
|
||||
ignore: () => { },
|
||||
};
|
||||
function last(nodes) {
|
||||
var _a;
|
||||
return (_a = nodes[nodes.length - 1]) !== null && _a !== void 0 ? _a : null;
|
||||
}
|
||||
function getLastItem(node) {
|
||||
switch (node.type) {
|
||||
case utils_1.AST_NODE_TYPES.TSEnumDeclaration:
|
||||
return last(node.members);
|
||||
case utils_1.AST_NODE_TYPES.TSTypeParameterDeclaration:
|
||||
return last(node.params);
|
||||
case utils_1.AST_NODE_TYPES.TSTupleType:
|
||||
return last(node.elementTypes);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function getTrailingToken(node) {
|
||||
const last = getLastItem(node);
|
||||
const trailing = last && sourceCode.getTokenAfter(last);
|
||||
return trailing;
|
||||
}
|
||||
function isMultiline(node) {
|
||||
const last = getLastItem(node);
|
||||
const lastToken = sourceCode.getLastToken(node);
|
||||
return (last === null || last === void 0 ? void 0 : last.loc.end.line) !== (lastToken === null || lastToken === void 0 ? void 0 : lastToken.loc.end.line);
|
||||
}
|
||||
function forbidComma(node) {
|
||||
const last = getLastItem(node);
|
||||
const trailing = getTrailingToken(node);
|
||||
if (last && trailing && util.isCommaToken(trailing)) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'unexpected',
|
||||
fix(fixer) {
|
||||
return fixer.remove(trailing);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
function forceComma(node) {
|
||||
const last = getLastItem(node);
|
||||
const trailing = getTrailingToken(node);
|
||||
if (last && trailing && !util.isCommaToken(trailing)) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'missing',
|
||||
fix(fixer) {
|
||||
return fixer.insertTextAfter(last, ',');
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
function allowCommaIfMultiline(node) {
|
||||
if (!isMultiline(node)) {
|
||||
forbidComma(node);
|
||||
}
|
||||
}
|
||||
function forceCommaIfMultiline(node) {
|
||||
if (isMultiline(node)) {
|
||||
forceComma(node);
|
||||
}
|
||||
else {
|
||||
forbidComma(node);
|
||||
}
|
||||
}
|
||||
return Object.assign(Object.assign({}, rules), { TSEnumDeclaration: predicate[normalizedOptions.enums], TSTypeParameterDeclaration: predicate[normalizedOptions.generics], TSTupleType: predicate[normalizedOptions.tuples] });
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=comma-dangle.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-dangle.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-dangle.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"comma-dangle.js","sourceRoot":"","sources":["../../src/rules/comma-dangle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA0D;AAE1D,8CAAgC;AAChC,iEAA8D;AAE9D,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC,cAAc,CAAC,CAAC;AAUnD,MAAM,mBAAmB,GAAG;IAC1B,kBAAkB;IAClB,QAAQ;IACR,OAAO;IACP,gBAAgB;CACjB,CAAC;AAEF,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAErC,SAAS,gBAAgB,CAAC,OAAe;;IACvC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,OAAO;YACL,KAAK,EAAE,OAAO;YACd,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,OAAO;SAChB,CAAC;KACH;IACD,OAAO;QACL,KAAK,EAAE,MAAA,OAAO,CAAC,KAAK,mCAAI,oBAAoB;QAC5C,QAAQ,EAAE,MAAA,OAAO,CAAC,QAAQ,mCAAI,oBAAoB;QAClD,MAAM,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,oBAAoB;KAC/C,CAAC;AACJ,CAAC;AAED,kBAAe,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;YAChD,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;gBACrB,UAAU,CAAC,IAAI,CAAC,CAAC;aAClB;iBAAM;gBACL,WAAW,CAAC,IAAI,CAAC,CAAC;aACnB;QACH,CAAC;QAED,uCACK,KAAK,KACR,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,CAAC,KAAK,CAAC,EACrD,0BAA0B,EAAE,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CAAC,EACjE,WAAW,EAAE,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAChD;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
150
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-spacing.js
generated
vendored
Normal file
150
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-spacing.js
generated
vendored
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
"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: 'comma-spacing',
|
||||
meta: {
|
||||
type: 'layout',
|
||||
docs: {
|
||||
description: 'Enforce consistent spacing before and after commas',
|
||||
recommended: false,
|
||||
extendsBaseRule: true,
|
||||
},
|
||||
fixable: 'whitespace',
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
before: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
after: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
messages: {
|
||||
unexpected: `There should be no space {{loc}} ','.`,
|
||||
missing: `A space is required {{loc}} ','.`,
|
||||
},
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
before: false,
|
||||
after: true,
|
||||
},
|
||||
],
|
||||
create(context, [{ before: spaceBefore, after: spaceAfter }]) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
const tokensAndComments = sourceCode.tokensAndComments;
|
||||
const ignoredTokens = new Set();
|
||||
/**
|
||||
* Adds null elements of the ArrayExpression or ArrayPattern node to the ignore list
|
||||
* @param node node to evaluate
|
||||
*/
|
||||
function addNullElementsToIgnoreList(node) {
|
||||
let previousToken = sourceCode.getFirstToken(node);
|
||||
for (const element of node.elements) {
|
||||
let token;
|
||||
if (element == null) {
|
||||
token = sourceCode.getTokenAfter(previousToken);
|
||||
if (token && (0, util_1.isCommaToken)(token)) {
|
||||
ignoredTokens.add(token);
|
||||
}
|
||||
}
|
||||
else {
|
||||
token = sourceCode.getTokenAfter(element);
|
||||
}
|
||||
previousToken = token;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Adds type parameters trailing comma token to the ignore list
|
||||
* @param node node to evaluate
|
||||
*/
|
||||
function addTypeParametersTrailingCommaToIgnoreList(node) {
|
||||
const paramLength = node.params.length;
|
||||
if (paramLength) {
|
||||
const param = node.params[paramLength - 1];
|
||||
const afterToken = sourceCode.getTokenAfter(param);
|
||||
if (afterToken && (0, util_1.isCommaToken)(afterToken)) {
|
||||
ignoredTokens.add(afterToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Validates the spacing around a comma token.
|
||||
* @param commaToken The token representing the comma
|
||||
* @param prevToken The last token before the comma
|
||||
* @param nextToken The first token after the comma
|
||||
*/
|
||||
function validateCommaSpacing(commaToken, prevToken, nextToken) {
|
||||
if (prevToken &&
|
||||
(0, util_1.isTokenOnSameLine)(prevToken, commaToken) &&
|
||||
// eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0
|
||||
spaceBefore !== sourceCode.isSpaceBetweenTokens(prevToken, commaToken)) {
|
||||
context.report({
|
||||
node: commaToken,
|
||||
data: {
|
||||
loc: 'before',
|
||||
},
|
||||
messageId: spaceBefore ? 'missing' : 'unexpected',
|
||||
fix: fixer => spaceBefore
|
||||
? fixer.insertTextBefore(commaToken, ' ')
|
||||
: fixer.replaceTextRange([prevToken.range[1], commaToken.range[0]], ''),
|
||||
});
|
||||
}
|
||||
if (nextToken && (0, util_1.isClosingParenToken)(nextToken)) {
|
||||
return;
|
||||
}
|
||||
if (spaceAfter &&
|
||||
nextToken &&
|
||||
((0, util_1.isClosingBraceToken)(nextToken) || (0, util_1.isClosingBracketToken)(nextToken))) {
|
||||
return;
|
||||
}
|
||||
if (!spaceAfter && nextToken && nextToken.type === utils_1.AST_TOKEN_TYPES.Line) {
|
||||
return;
|
||||
}
|
||||
if (nextToken &&
|
||||
(0, util_1.isTokenOnSameLine)(commaToken, nextToken) &&
|
||||
// eslint-disable-next-line deprecation/deprecation -- TODO - switch once our min ESLint version is 6.7.0
|
||||
spaceAfter !== sourceCode.isSpaceBetweenTokens(commaToken, nextToken)) {
|
||||
context.report({
|
||||
node: commaToken,
|
||||
data: {
|
||||
loc: 'after',
|
||||
},
|
||||
messageId: spaceAfter ? 'missing' : 'unexpected',
|
||||
fix: fixer => spaceAfter
|
||||
? fixer.insertTextAfter(commaToken, ' ')
|
||||
: fixer.replaceTextRange([commaToken.range[1], nextToken.range[0]], ''),
|
||||
});
|
||||
}
|
||||
}
|
||||
return {
|
||||
TSTypeParameterDeclaration: addTypeParametersTrailingCommaToIgnoreList,
|
||||
ArrayExpression: addNullElementsToIgnoreList,
|
||||
ArrayPattern: addNullElementsToIgnoreList,
|
||||
'Program:exit'() {
|
||||
tokensAndComments.forEach((token, i) => {
|
||||
if (!(0, util_1.isCommaToken)(token)) {
|
||||
return;
|
||||
}
|
||||
const prevToken = tokensAndComments[i - 1];
|
||||
const nextToken = tokensAndComments[i + 1];
|
||||
validateCommaSpacing(token, (0, util_1.isCommaToken)(prevToken) || ignoredTokens.has(token)
|
||||
? null
|
||||
: prevToken, (nextToken && (0, util_1.isCommaToken)(nextToken)) || ignoredTokens.has(token)
|
||||
? null
|
||||
: nextToken);
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=comma-spacing.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-spacing.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-spacing.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"comma-spacing.js","sourceRoot":"","sources":["../../src/rules/comma-spacing.ts"],"names":[],"mappings":";;AACA,oDAA2D;AAE3D,kCAOiB;AAUjB,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE;YACJ,WAAW,EAAE,oDAAoD;YACjE,WAAW,EAAE,KAAK;YAClB,eAAe,EAAE,IAAI;SACtB;QACD,OAAO,EAAE,YAAY;QACrB,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,MAAM,EAAE;wBACN,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,KAAK;qBACf;oBACD,KAAK,EAAE;wBACL,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,IAAI;qBACd;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,QAAQ,EAAE;YACR,UAAU,EAAE,uCAAuC;YACnD,OAAO,EAAE,kCAAkC;SAC5C;KACF;IACD,cAAc,EAAE;QACd;YACE,MAAM,EAAE,KAAK;YACb,KAAK,EAAE,IAAI;SACZ;KACF;IACD,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;QAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3C,MAAM,iBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC;QACvD,MAAM,aAAa,GAAG,IAAI,GAAG,EAA4B,CAAC;QAE1D;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AAC,gBAAgB,CACpB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACzC,EAAE,CACH;iBACR,CAAC,CAAC;aACJ;QACH,CAAC;QAED,OAAO;YACL,0BAA0B,EAAE,0CAA0C;YACtE,eAAe,EAAE,2BAA2B;YAC5C,YAAY,EAAE,2BAA2B;YAEzC,cAAc;gBACZ,iBAAiB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;oBACrC,IAAI,CAAC,IAAA,mBAAY,EAAC,KAAK,CAAC,EAAE;wBACxB,OAAO;qBACR;oBAED,MAAM,SAAS,GAAG,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;oBAC3C,MAAM,SAAS,GAAG,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;oBAE3C,oBAAoB,CAClB,KAAK,EACL,IAAA,mBAAY,EAAC,SAAS,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC;wBACjD,CAAC,CAAC,IAAI;wBACN,CAAC,CAAC,SAAS,EACb,CAAC,SAAS,IAAI,IAAA,mBAAY,EAAC,SAAS,CAAC,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC;wBAChE,CAAC,CAAC,IAAI;wBACN,CAAC,CAAC,SAAS,CACd,CAAC;gBACJ,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
110
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js
generated
vendored
Normal file
110
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js
generated
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
"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: 'strict',
|
||||
},
|
||||
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: [
|
||||
{
|
||||
enum: ['type-annotation', 'constructor'],
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: ['constructor'],
|
||||
create(context, [mode]) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
return {
|
||||
'VariableDeclarator,PropertyDefinition,:matches(FunctionDeclaration,FunctionExpression) > AssignmentPattern'(node) {
|
||||
var _a, _b;
|
||||
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 = (_a = lhsName.typeAnnotation) === null || _a === void 0 ? void 0 : _a.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.typeParameters) {
|
||||
const { typeParameters, callee } = rhs;
|
||||
const typeAnnotation = sourceCode.getText(callee) + sourceCode.getText(typeParameters);
|
||||
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 sourceCode.getTokenAfter(node.key);
|
||||
}
|
||||
return [
|
||||
fixer.remove(typeParameters),
|
||||
fixer.insertTextAfter(getIDToAttachAnnotation(), ': ' + typeAnnotation),
|
||||
];
|
||||
},
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (mode === 'constructor') {
|
||||
if ((lhs === null || lhs === void 0 ? void 0 : lhs.typeParameters) && !rhs.typeParameters) {
|
||||
const hasParens = ((_b = sourceCode.getTokenAfter(rhs.callee)) === null || _b === void 0 ? void 0 : _b.value) === '(';
|
||||
const extraComments = new Set(sourceCode.getCommentsInside(lhs.parent));
|
||||
sourceCode
|
||||
.getCommentsInside(lhs.typeParameters)
|
||||
.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, sourceCode.getText(comment));
|
||||
}
|
||||
yield fixer.insertTextAfter(rhs.callee, sourceCode.getText(lhs.typeParameters));
|
||||
if (!hasParens) {
|
||||
yield fixer.insertTextAfter(rhs.callee, '()');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=consistent-generic-constructors.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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,kCAAqC;AAKrC,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,QAAQ;SACtB;QACD,QAAQ,EAAE;YACR,oBAAoB,EAClB,gFAAgF;YAClF,iBAAiB,EACf,2FAA2F;SAC9F;QACD,OAAO,EAAE,MAAM;QACf,MAAM,EAAE;YACN;gBACE,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,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3C,OAAO;YACL,4GAA4G,CAC1G,IAG8B;;gBAE9B,SAAS,SAAS;oBAIhB,QAAQ,IAAI,CAAC,IAAI,EAAE;wBACjB,KAAK,sBAAc,CAAC,kBAAkB;4BACpC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;wBAC9B,KAAK,sBAAc,CAAC,kBAAkB;4BACpC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;wBAC5B,KAAK,sBAAc,CAAC,iBAAiB;4BACnC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CA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c,CAAC,CACvC,CAAC;gCACF,IAAI,CAAC,SAAS,EAAE;oCACd,MAAM,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;iCAC/C;4BACH,CAAC;yBACF,CAAC,CAAC;qBACJ;iBACF;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
126
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js
generated
vendored
Normal file
126
node_modules/eslint-plugin-github/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: 'strict',
|
||||
},
|
||||
messages: {
|
||||
preferRecord: 'A record is preferred over an index signature.',
|
||||
preferIndexSignature: 'An index signature is preferred over a record.',
|
||||
},
|
||||
fixable: 'code',
|
||||
schema: [
|
||||
{
|
||||
enum: ['record', 'index-signature'],
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: ['record'],
|
||||
create(context, [mode]) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
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;
|
||||
if (!parameter) {
|
||||
return;
|
||||
}
|
||||
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.getScope();
|
||||
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 = sourceCode.getText(keyType.typeAnnotation);
|
||||
const value = sourceCode.getText(valueType.typeAnnotation);
|
||||
const record = member.readonly
|
||||
? `Readonly<Record<${key}, ${value}>>`
|
||||
: `Record<${key}, ${value}>`;
|
||||
return fixer.replaceText(node, `${prefix}${record}${postfix}`);
|
||||
}
|
||||
: null,
|
||||
});
|
||||
}
|
||||
return Object.assign(Object.assign({}, (mode === 'index-signature' && {
|
||||
TSTypeReference(node) {
|
||||
var _a;
|
||||
const typeName = node.typeName;
|
||||
if (typeName.type !== utils_1.AST_NODE_TYPES.Identifier) {
|
||||
return;
|
||||
}
|
||||
if (typeName.name !== 'Record') {
|
||||
return;
|
||||
}
|
||||
const params = (_a = node.typeParameters) === null || _a === void 0 ? void 0 : _a.params;
|
||||
if ((params === null || params === void 0 ? void 0 : params.length) !== 2) {
|
||||
return;
|
||||
}
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'preferIndexSignature',
|
||||
fix(fixer) {
|
||||
const key = sourceCode.getText(params[0]);
|
||||
const type = sourceCode.getText(params[1]);
|
||||
return fixer.replaceText(node, `{ [key: ${key}]: ${type} }`);
|
||||
},
|
||||
});
|
||||
},
|
||||
})), (mode === 'record' && {
|
||||
TSTypeLiteral(node) {
|
||||
const parent = findParentDeclaration(node);
|
||||
checkMembers(node.members, node, parent === null || parent === void 0 ? void 0 : parent.id, '', '');
|
||||
},
|
||||
TSInterfaceDeclaration(node) {
|
||||
var _a, _b, _c, _d;
|
||||
let genericTypes = '';
|
||||
if (((_b = (_a = node.typeParameters) === null || _a === void 0 ? void 0 : _a.params) !== null && _b !== void 0 ? _b : []).length > 0) {
|
||||
genericTypes = `<${(_c = node.typeParameters) === null || _c === void 0 ? void 0 : _c.params.map(p => sourceCode.getText(p)).join(', ')}>`;
|
||||
}
|
||||
checkMembers(node.body.body, node, node.id, `type ${node.id.name}${genericTypes} = `, ';', !((_d = node.extends) === null || _d === void 0 ? void 0 : _d.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/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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":";;AACA,oDAAoE;AAEpE,kCAAqC;AAKrC,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,uCAAuC;YACpD,WAAW,EAAE,QAAQ;SACtB;QACD,QAAQ,EAAE;YACR,YAAY,EAAE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IAAI,EACd,IAAI,EACJ,IAAI,CAAC,EAAE,EACP,QAAQ,IAAI,CAAC,EAAE,CAAC,IAAI,GAAG,YAAY,KAAK,EACxC,GAAG,EACH,CAAC,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,CAAA,CACtB,CAAC;YACJ,CAAC;SACF,CAAC,EACF;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;QACvE,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,sBAAsB,EAAE;YAC9D,OAAO,IAAI,CAAC,MAAM,CAAC;SACpB;QACD,OAAO,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAC3C;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
||||
204
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-assertions.js
generated
vendored
Normal file
204
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-assertions.js
generated
vendored
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
"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 util = __importStar(require("../util"));
|
||||
exports.default = util.createRule({
|
||||
name: 'consistent-type-assertions',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
fixable: 'code',
|
||||
hasSuggestions: true,
|
||||
docs: {
|
||||
description: 'Enforce consistent usage of type assertions',
|
||||
recommended: 'strict',
|
||||
},
|
||||
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: {
|
||||
enum: ['never'],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
required: ['assertionStyle'],
|
||||
},
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
assertionStyle: {
|
||||
enum: ['as', 'angle-bracket'],
|
||||
},
|
||||
objectLiteralTypeAssertions: {
|
||||
enum: ['allow', 'allow-as-parameter', 'never'],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
required: ['assertionStyle'],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
assertionStyle: 'as',
|
||||
objectLiteralTypeAssertions: 'allow',
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
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 getTextWithParentheses(node) {
|
||||
// Capture parentheses before and after the node
|
||||
let beforeCount = 0;
|
||||
let afterCount = 0;
|
||||
if (util.isParenthesized(node, sourceCode)) {
|
||||
const bodyOpeningParen = sourceCode.getTokenBefore(node, util.isOpeningParenToken);
|
||||
const bodyClosingParen = sourceCode.getTokenAfter(node, util.isClosingParenToken);
|
||||
beforeCount = node.range[0] - bodyOpeningParen.range[0];
|
||||
afterCount = bodyClosingParen.range[1] - node.range[1];
|
||||
}
|
||||
return sourceCode.getText(node, beforeCount, afterCount);
|
||||
}
|
||||
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: sourceCode.getText(node.typeAnnotation) }
|
||||
: {},
|
||||
fix: messageId === 'as'
|
||||
? (fixer) => [
|
||||
fixer.replaceText(node, getTextWithParentheses(node.expression)),
|
||||
fixer.insertTextAfter(node, ` as ${getTextWithParentheses(node.typeAnnotation)}`),
|
||||
]
|
||||
: 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) {
|
||||
var _a;
|
||||
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 &&
|
||||
(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)) {
|
||||
return;
|
||||
}
|
||||
if (checkType(node.typeAnnotation) &&
|
||||
node.expression.type === utils_1.AST_NODE_TYPES.ObjectExpression) {
|
||||
const suggest = [];
|
||||
if (((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.AST_NODE_TYPES.VariableDeclarator &&
|
||||
!node.parent.id.typeAnnotation) {
|
||||
const { parent } = node;
|
||||
suggest.push({
|
||||
messageId: 'replaceObjectTypeAssertionWithAnnotation',
|
||||
data: { cast: sourceCode.getText(node.typeAnnotation) },
|
||||
fix: fixer => [
|
||||
fixer.insertTextAfter(parent.id, `: ${sourceCode.getText(node.typeAnnotation)}`),
|
||||
fixer.replaceText(node, getTextWithParentheses(node.expression)),
|
||||
],
|
||||
});
|
||||
}
|
||||
suggest.push({
|
||||
messageId: 'replaceObjectTypeAssertionWithSatisfies',
|
||||
data: { cast: sourceCode.getText(node.typeAnnotation) },
|
||||
fix: fixer => [
|
||||
fixer.replaceText(node, getTextWithParentheses(node.expression)),
|
||||
fixer.insertTextAfter(node, ` satisfies ${context
|
||||
.getSourceCode()
|
||||
.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/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-assertions.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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
122
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-definitions.js
generated
vendored
Normal file
122
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-definitions.js
generated
vendored
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
"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 util = __importStar(require("../util"));
|
||||
exports.default = util.createRule({
|
||||
name: 'consistent-type-definitions',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce type definitions to consistently use either `interface` or `type`',
|
||||
recommended: 'strict',
|
||||
},
|
||||
messages: {
|
||||
interfaceOverType: 'Use an `interface` instead of a `type`.',
|
||||
typeOverInterface: 'Use a `type` instead of an `interface`.',
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
enum: ['interface', 'type'],
|
||||
},
|
||||
],
|
||||
fixable: 'code',
|
||||
},
|
||||
defaultOptions: ['interface'],
|
||||
create(context, [option]) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
/**
|
||||
* Iterates from the highest parent to the currently traversed node
|
||||
* to determine whether any node in tree is globally declared module declaration
|
||||
*/
|
||||
function isCurrentlyTraversedNodeWithinModuleDeclaration() {
|
||||
return context
|
||||
.getAncestors()
|
||||
.some(node => node.type === utils_1.AST_NODE_TYPES.TSModuleDeclaration &&
|
||||
node.declare &&
|
||||
node.global);
|
||||
}
|
||||
return Object.assign(Object.assign({}, (option === 'interface' && {
|
||||
"TSTypeAliasDeclaration[typeAnnotation.type='TSTypeLiteral']"(node) {
|
||||
context.report({
|
||||
node: node.id,
|
||||
messageId: 'interfaceOverType',
|
||||
fix(fixer) {
|
||||
var _a;
|
||||
const typeNode = (_a = node.typeParameters) !== null && _a !== void 0 ? _a : node.id;
|
||||
const fixes = [];
|
||||
const firstToken = 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 = 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()
|
||||
? null
|
||||
: (fixer) => {
|
||||
var _a, _b;
|
||||
const typeNode = (_a = node.typeParameters) !== null && _a !== void 0 ? _a : node.id;
|
||||
const fixes = [];
|
||||
const firstToken = sourceCode.getTokenBefore(node.id);
|
||||
if (firstToken) {
|
||||
fixes.push(fixer.replaceText(firstToken, 'type'));
|
||||
fixes.push(fixer.replaceTextRange([typeNode.range[1], node.body.range[0]], ' = '));
|
||||
}
|
||||
if (node.extends) {
|
||||
node.extends.forEach(heritage => {
|
||||
const typeIdentifier = sourceCode.getText(heritage);
|
||||
fixes.push(fixer.insertTextAfter(node.body, ` & ${typeIdentifier}`));
|
||||
});
|
||||
}
|
||||
if (((_b = node.parent) === null || _b === void 0 ? void 0 : _b.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/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-definitions.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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,8CAAgC;AAEhC,kBAAe,IAAI,CAAC,UAAU,CAAC;IAC7B,IAAI,EAAE,6BAA6B;IACnC,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EACT,2EAA2E;YAC7E,WAAW,EAAE,QAAQ;SACtB;QACD,QAAQ,EAAE;YACR,iBAAiB,EAAE,yCAAyC;YAC5D,iBAAiB,EAAE,yCAAyC;SAC7D;QACD,MAAM,EAAE;YACN;gBACE,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,CAAC;QACtB,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAE3C;;;WAGG;QACH,SAAS,+CAA+C;YACtD,OAAO,OAAO;iBACX,YAAY,EAAE;iBACd,IAAI,CACH,IAAI,CAAC,EAAE,CACL,IAAI,CAAC,IAAI,KAAK,sBAAc,CAAC,mBAAmB;gBAChD,IAAI,CAAC,OAAO;gBACZ,IAAI,CAAC,MAAM,CACd,CAAC;Q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C,CAAC;gBACN,OAAO,CAAC,MAAM,CAAC;oBACb,IAAI,EAAE,IAAI,CAAC,EAAE;oBACb,SAAS,EAAE,mBAAmB;oBAC9B;;;uBAGG;oBACH,GAAG;iBACJ,CAAC,CAAC;YACL,CAAC;SACF,CAAC,EACF;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
266
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-exports.js
generated
vendored
Normal file
266
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-exports.js
generated
vendored
Normal file
|
|
@ -0,0 +1,266 @@
|
|||
"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 typescript_1 = require("typescript");
|
||||
const util = __importStar(require("../util"));
|
||||
exports.default = util.createRule({
|
||||
name: 'consistent-type-exports',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce consistent usage of type exports',
|
||||
recommended: false,
|
||||
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 sourceCode = context.getSourceCode();
|
||||
const sourceExportsMap = {};
|
||||
const parserServices = util.getParserServices(context);
|
||||
return {
|
||||
ExportNamedDeclaration(node) {
|
||||
var _a;
|
||||
// Coerce the source into a string for use as a lookup entry.
|
||||
const source = (_a = getSourceFromExport(node)) !== null && _a !== void 0 ? _a : 'undefined';
|
||||
const sourceExports = (sourceExportsMap[source] || (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(parserServices, 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, 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, sourceCode, report);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
else {
|
||||
const exportNames = util.formatWordList(allExportNames);
|
||||
context.report({
|
||||
node: report.node,
|
||||
messageId: 'multipleExportsAreTypes',
|
||||
data: { exportNames },
|
||||
*fix(fixer) {
|
||||
if (fixMixedExportsWithInlineTypeSpecifier) {
|
||||
yield* fixAddTypeSpecifierToNamedExports(fixer, report);
|
||||
}
|
||||
else {
|
||||
yield* fixSeparateNamedExports(fixer, sourceCode, report);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
/**
|
||||
* 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(parserServices, specifier) {
|
||||
const checker = parserServices.program.getTypeChecker();
|
||||
const node = parserServices.esTreeNodeToTSNodeMap.get(specifier.exported);
|
||||
const symbol = checker.getSymbolAtLocation(node);
|
||||
const aliasedSymbol = checker.getAliasedSymbol(symbol);
|
||||
if (!aliasedSymbol || aliasedSymbol.escapedName === 'unknown') {
|
||||
return undefined;
|
||||
}
|
||||
return !(aliasedSymbol.flags & typescript_1.SymbolFlags.Value);
|
||||
}
|
||||
/**
|
||||
* Inserts "type" into an export.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* export type { Foo } from 'foo';
|
||||
* ^^^^
|
||||
*/
|
||||
function* fixExportInsertType(fixer, sourceCode, node) {
|
||||
const exportToken = util.nullThrows(sourceCode.getFirstToken(node), util.NullThrowsReasons.MissingToken('export', node.type));
|
||||
yield fixer.insertTextAfter(exportToken, ' type');
|
||||
for (const specifier of node.specifiers) {
|
||||
if (specifier.exportKind === 'type') {
|
||||
const kindToken = util.nullThrows(sourceCode.getFirstToken(specifier), util.NullThrowsReasons.MissingToken('export', specifier.type));
|
||||
const firstTokenAfter = util.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 = util.nullThrows(sourceCode.getFirstToken(node), util.NullThrowsReasons.MissingToken('export', node.type));
|
||||
// Filter the bad exports from the current line.
|
||||
const filteredSpecifierNames = valueSpecifiers
|
||||
.map(getSpecifierText)
|
||||
.join(', ');
|
||||
const openToken = util.nullThrows(sourceCode.getFirstToken(node, util.isOpeningBraceToken), util.NullThrowsReasons.MissingToken('{', node.type));
|
||||
const closeToken = util.nullThrows(sourceCode.getLastToken(node, util.isClosingBraceToken), util.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) {
|
||||
var _a;
|
||||
if (((_a = node.source) === null || _a === void 0 ? void 0 : _a.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/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-exports.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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
644
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-imports.js
generated
vendored
Normal file
644
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-imports.js
generated
vendored
Normal file
|
|
@ -0,0 +1,644 @@
|
|||
"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 util = __importStar(require("../util"));
|
||||
exports.default = util.createRule({
|
||||
name: 'consistent-type-imports',
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Enforce consistent usage of type imports',
|
||||
recommended: false,
|
||||
},
|
||||
messages: {
|
||||
typeOverValue: 'All imports in the declaration are only used as types. Use `import type`.',
|
||||
someImportsAreOnlyTypes: 'Imports {{typeImports}} are only used as types.',
|
||||
aImportIsOnlyTypes: 'Import {{typeImports}} is only used as types.',
|
||||
someImportsInDecoMeta: 'Type imports {{typeImports}} are used by decorator metadata.',
|
||||
aImportInDecoMeta: 'Type import {{typeImports}} is used by decorator metadata.',
|
||||
valueOverType: 'Use an `import` instead of an `import type`.',
|
||||
noImportTypeAnnotations: '`import()` type annotations are forbidden.',
|
||||
},
|
||||
schema: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
prefer: {
|
||||
enum: ['type-imports', 'no-type-imports'],
|
||||
},
|
||||
disallowTypeAnnotations: {
|
||||
type: 'boolean',
|
||||
},
|
||||
fixStyle: {
|
||||
enum: ['separate-type-imports', 'inline-type-imports'],
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
fixable: 'code',
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
prefer: 'type-imports',
|
||||
disallowTypeAnnotations: true,
|
||||
fixStyle: 'separate-type-imports',
|
||||
},
|
||||
],
|
||||
create(context, [option]) {
|
||||
var _a, _b;
|
||||
const prefer = (_a = option.prefer) !== null && _a !== void 0 ? _a : 'type-imports';
|
||||
const disallowTypeAnnotations = option.disallowTypeAnnotations !== false;
|
||||
const fixStyle = (_b = option.fixStyle) !== null && _b !== void 0 ? _b : 'separate-type-imports';
|
||||
const sourceCode = context.getSourceCode();
|
||||
const sourceImportsMap = {};
|
||||
return Object.assign(Object.assign({}, (prefer === 'type-imports'
|
||||
? {
|
||||
// prefer type imports
|
||||
ImportDeclaration(node) {
|
||||
var _a;
|
||||
const source = node.source.value;
|
||||
// sourceImports is the object containing all the specifics for a particular import source, type or value
|
||||
const sourceImports = (_a = sourceImportsMap[source]) !== null && _a !== void 0 ? _a : (sourceImportsMap[source] = {
|
||||
source,
|
||||
reportValueImports: [],
|
||||
typeOnlyNamedImport: null,
|
||||
valueOnlyNamedImport: null,
|
||||
valueImport: null, // if only value imports
|
||||
});
|
||||
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.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.getDeclaredVariables(specifier);
|
||||
if (variable.references.length === 0) {
|
||||
unusedSpecifiers.push(specifier);
|
||||
}
|
||||
else {
|
||||
const onlyHasTypeReferences = variable.references.every(ref => {
|
||||
var _a, _b;
|
||||
/**
|
||||
* keep origin import kind when export
|
||||
* export { Type }
|
||||
* export default Type;
|
||||
*/
|
||||
if (((_a = ref.identifier.parent) === null || _a === void 0 ? void 0 : _a.type) ===
|
||||
utils_1.AST_NODE_TYPES.ExportSpecifier ||
|
||||
((_b = ref.identifier.parent) === null || _b === void 0 ? void 0 : _b.type) ===
|
||||
utils_1.AST_NODE_TYPES.ExportDefaultDeclaration) {
|
||||
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) ||
|
||||
(node.importKind === 'type' && valueSpecifiers.length)) {
|
||||
sourceImports.reportValueImports.push({
|
||||
node,
|
||||
typeSpecifiers,
|
||||
valueSpecifiers,
|
||||
unusedSpecifiers,
|
||||
inlineTypeSpecifiers,
|
||||
});
|
||||
}
|
||||
},
|
||||
'Program:exit'() {
|
||||
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') {
|
||||
context.report({
|
||||
node: report.node,
|
||||
messageId: 'typeOverValue',
|
||||
*fix(fixer) {
|
||||
yield* fixToTypeImportDeclaration(fixer, report, sourceImports);
|
||||
},
|
||||
});
|
||||
}
|
||||
else {
|
||||
const isTypeImport = report.node.importKind === 'type';
|
||||
// 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 = (isTypeImport
|
||||
? report.valueSpecifiers // import type { A } from 'roo'; // WHERE A is used in value position
|
||||
: report.typeSpecifiers) // import { A, B } from 'roo'; // WHERE A is used in type position and B is in value position
|
||||
.map(specifier => `"${specifier.local.name}"`);
|
||||
const message = (() => {
|
||||
const typeImports = util.formatWordList(importNames);
|
||||
if (importNames.length === 1) {
|
||||
if (isTypeImport) {
|
||||
return {
|
||||
messageId: 'aImportInDecoMeta',
|
||||
data: { typeImports },
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
messageId: 'aImportIsOnlyTypes',
|
||||
data: { typeImports },
|
||||
};
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isTypeImport) {
|
||||
return {
|
||||
messageId: 'someImportsInDecoMeta',
|
||||
data: { typeImports }, // typeImports are all the value specifiers that are in the type position
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
messageId: 'someImportsAreOnlyTypes',
|
||||
data: { typeImports }, // typeImports are all the type specifiers in the value position
|
||||
};
|
||||
}
|
||||
}
|
||||
})();
|
||||
context.report(Object.assign(Object.assign({ node: report.node }, message), { *fix(fixer) {
|
||||
if (isTypeImport) {
|
||||
// take all the valueSpecifiers and put them on a new line
|
||||
yield* fixToValueImportDeclaration(fixer, report, sourceImports);
|
||||
}
|
||||
else {
|
||||
// take all the typeSpecifiers and put them on a new line
|
||||
yield* fixToTypeImportDeclaration(fixer, report, sourceImports);
|
||||
}
|
||||
} }));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
: {
|
||||
// prefer no type imports
|
||||
'ImportDeclaration[importKind = "type"]'(node) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'valueOverType',
|
||||
fix(fixer) {
|
||||
return fixRemoveTypeSpecifierFromImportDeclaration(fixer, node);
|
||||
},
|
||||
});
|
||||
},
|
||||
'ImportSpecifier[importKind = "type"]'(node) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'valueOverType',
|
||||
fix(fixer) {
|
||||
return fixRemoveTypeSpecifierFromImportSpecifier(fixer, node);
|
||||
},
|
||||
});
|
||||
},
|
||||
})), (disallowTypeAnnotations
|
||||
? {
|
||||
// disallow `import()` type
|
||||
TSImportType(node) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'noImportTypeAnnotations',
|
||||
});
|
||||
},
|
||||
}
|
||||
: {}));
|
||||
function classifySpecifier(node) {
|
||||
var _a;
|
||||
const defaultSpecifier = node.specifiers[0].type === utils_1.AST_NODE_TYPES.ImportDefaultSpecifier
|
||||
? node.specifiers[0]
|
||||
: null;
|
||||
const namespaceSpecifier = (_a = node.specifiers.find((specifier) => specifier.type === utils_1.AST_NODE_TYPES.ImportNamespaceSpecifier)) !== null && _a !== void 0 ? _a : 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 = util.nullThrows(sourceCode.getTokenBefore(subsetNamedSpecifiers[0], util.isOpeningBraceToken), util.NullThrowsReasons.MissingToken('{', node.type));
|
||||
const commaToken = util.nullThrows(sourceCode.getTokenBefore(openingBraceToken, util.isCommaToken), util.NullThrowsReasons.MissingToken(',', node.type));
|
||||
const closingBraceToken = util.nullThrows(sourceCode.getFirstTokenBetween(openingBraceToken, node.source, util.isClosingBraceToken), util.NullThrowsReasons.MissingToken('}', node.type));
|
||||
// import DefType, {...} from 'foo'
|
||||
// ^^^^^^^ remove
|
||||
removeTypeNamedSpecifiers.push(fixer.removeRange([commaToken.range[0], closingBraceToken.range[1]]));
|
||||
typeNamedSpecifiersTexts.push(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(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 = sourceCode.getTokenBefore(first);
|
||||
textRange[0] = before.range[1];
|
||||
if (util.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 = sourceCode.getTokenAfter(last);
|
||||
textRange[1] = after.range[0];
|
||||
if (isFirst || isLast) {
|
||||
if (util.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 = util.nullThrows(sourceCode.getFirstTokenBetween(sourceCode.getFirstToken(target), target.source, util.isClosingBraceToken), util.NullThrowsReasons.MissingToken('}', target.type));
|
||||
const before = sourceCode.getTokenBefore(closingBraceToken);
|
||||
if (!util.isCommaToken(before) && !util.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 = 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'
|
||||
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
|
||||
if (fixStyle === 'inline-type-imports') {
|
||||
yield fixer.insertTextBefore(node, `import {${typeNamedSpecifiers
|
||||
.map(spec => {
|
||||
const insertText = sourceCode.text.slice(...spec.range);
|
||||
return `type ${insertText}`;
|
||||
})
|
||||
.join(', ')}} from ${sourceCode.getText(node.source)};\n`);
|
||||
}
|
||||
else {
|
||||
yield fixer.insertTextBefore(node, `import type {${fixesNamedSpecifiers.typeNamedSpecifiersText}} from ${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 = util.nullThrows(sourceCode.getTokenBefore(namespaceSpecifier, util.isCommaToken), util.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 ${sourceCode.getText(namespaceSpecifier)} from ${sourceCode.getText(node.source)};\n`);
|
||||
}
|
||||
if (defaultSpecifier &&
|
||||
report.typeSpecifiers.includes(defaultSpecifier)) {
|
||||
if (report.typeSpecifiers.length === node.specifiers.length) {
|
||||
const importToken = util.nullThrows(sourceCode.getFirstToken(node, util.isImportKeyword), util.NullThrowsReasons.MissingToken('import', node.type));
|
||||
// import type Type from 'foo'
|
||||
// ^^^^ insert
|
||||
yield fixer.insertTextAfter(importToken, ' type');
|
||||
}
|
||||
else {
|
||||
const commaToken = util.nullThrows(sourceCode.getTokenAfter(defaultSpecifier, util.isCommaToken), util.NullThrowsReasons.MissingToken(',', defaultSpecifier.type));
|
||||
// import Type , {...} from 'foo'
|
||||
// ^^^^^ pick
|
||||
const defaultText = sourceCode.text
|
||||
.slice(defaultSpecifier.range[0], commaToken.range[0])
|
||||
.trim();
|
||||
yield fixer.insertTextBefore(node, `import type ${defaultText} from ${sourceCode.getText(node.source)};\n`);
|
||||
const afterToken = util.nullThrows(sourceCode.getTokenAfter(commaToken, { includeComments: true }), util.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 = util.nullThrows(sourceCode.getFirstToken(node, util.isImportKeyword), util.NullThrowsReasons.MissingToken('import', node.type));
|
||||
yield fixer.insertTextAfter(importToken, ' type');
|
||||
if (isDefaultImport) {
|
||||
// Has default import
|
||||
const openingBraceToken = sourceCode.getFirstTokenBetween(importToken, node.source, util.isOpeningBraceToken);
|
||||
if (openingBraceToken) {
|
||||
// Only braces. e.g. import Foo, {} from 'foo'
|
||||
const commaToken = util.nullThrows(sourceCode.getTokenBefore(openingBraceToken, util.isCommaToken), util.NullThrowsReasons.MissingToken(',', node.type));
|
||||
const closingBraceToken = util.nullThrows(sourceCode.getFirstTokenBetween(openingBraceToken, node.source, util.isClosingBraceToken), util.NullThrowsReasons.MissingToken('}', node.type));
|
||||
// import type Foo, {} from 'foo'
|
||||
// ^^ remove
|
||||
yield fixer.removeRange([
|
||||
commaToken.range[0],
|
||||
closingBraceToken.range[1],
|
||||
]);
|
||||
const specifiersText = sourceCode.text.slice(commaToken.range[1], closingBraceToken.range[1]);
|
||||
if (node.specifiers.length > 1) {
|
||||
yield fixer.insertTextAfter(node, `\nimport type${specifiersText} from ${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* fixToValueImportDeclaration(fixer, report, sourceImports) {
|
||||
const { node } = report;
|
||||
const { defaultSpecifier, namespaceSpecifier, namedSpecifiers } = classifySpecifier(node);
|
||||
if (namespaceSpecifier) {
|
||||
// import type * as types from 'foo'
|
||||
yield* fixRemoveTypeSpecifierFromImportDeclaration(fixer, node);
|
||||
return;
|
||||
}
|
||||
else if (defaultSpecifier) {
|
||||
if (report.valueSpecifiers.includes(defaultSpecifier) &&
|
||||
namedSpecifiers.length === 0) {
|
||||
// import type Type from 'foo'
|
||||
yield* fixRemoveTypeSpecifierFromImportDeclaration(fixer, node);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (namedSpecifiers.every(specifier => report.valueSpecifiers.includes(specifier))) {
|
||||
// import type {Type1, Type2} from 'foo'
|
||||
yield* fixRemoveTypeSpecifierFromImportDeclaration(fixer, node);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// we have some valueSpecifiers intermixed in types that need to be put on their own line
|
||||
// import type { Type1, A } from 'foo'
|
||||
// import type { A } from 'foo'
|
||||
const valueNamedSpecifiers = namedSpecifiers.filter(specifier => report.valueSpecifiers.includes(specifier));
|
||||
const fixesNamedSpecifiers = getFixesNamedSpecifiers(fixer, node, valueNamedSpecifiers, namedSpecifiers);
|
||||
const afterFixes = [];
|
||||
if (valueNamedSpecifiers.length) {
|
||||
if (sourceImports.valueOnlyNamedImport) {
|
||||
const insertTypeNamedSpecifiers = fixInsertNamedSpecifiersInNamedSpecifierList(fixer, sourceImports.valueOnlyNamedImport, fixesNamedSpecifiers.typeNamedSpecifiersText);
|
||||
if (sourceImports.valueOnlyNamedImport.range[1] <= node.range[0]) {
|
||||
yield insertTypeNamedSpecifiers;
|
||||
}
|
||||
else {
|
||||
afterFixes.push(insertTypeNamedSpecifiers);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// some are types.
|
||||
// Add new value import and later remove those value specifiers from import type
|
||||
yield fixer.insertTextBefore(node, `import {${fixesNamedSpecifiers.typeNamedSpecifiersText}} from ${sourceCode.getText(node.source)};\n`);
|
||||
}
|
||||
}
|
||||
yield* fixesNamedSpecifiers.removeTypeNamedSpecifiers;
|
||||
yield* afterFixes;
|
||||
}
|
||||
function* fixRemoveTypeSpecifierFromImportDeclaration(fixer, node) {
|
||||
var _a, _b;
|
||||
// import type Foo from 'foo'
|
||||
// ^^^^ remove
|
||||
const importToken = util.nullThrows(sourceCode.getFirstToken(node, util.isImportKeyword), util.NullThrowsReasons.MissingToken('import', node.type));
|
||||
const typeToken = util.nullThrows(sourceCode.getFirstTokenBetween(importToken, (_b = (_a = node.specifiers[0]) === null || _a === void 0 ? void 0 : _a.local) !== null && _b !== void 0 ? _b : node.source, util.isTypeKeyword), util.NullThrowsReasons.MissingToken('type', node.type));
|
||||
const afterToken = util.nullThrows(sourceCode.getTokenAfter(typeToken, { includeComments: true }), util.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 = util.nullThrows(sourceCode.getFirstToken(node, util.isTypeKeyword), util.NullThrowsReasons.MissingToken('type', node.type));
|
||||
const afterToken = util.nullThrows(sourceCode.getTokenAfter(typeToken, { includeComments: true }), util.NullThrowsReasons.MissingToken('any token', node.type));
|
||||
yield fixer.removeRange([typeToken.range[0], afterToken.range[0]]);
|
||||
}
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=consistent-type-imports.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-imports.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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
64
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/default-param-last.js
generated
vendored
Normal file
64
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/default-param-last.js
generated
vendored
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
"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',
|
||||
recommended: false,
|
||||
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 'optional' in node && node.optional === true;
|
||||
}
|
||||
/**
|
||||
* 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/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/default-param-last.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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,oD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AAe,CAAC,KAAK,CAAC;wBACrB,KAAK,CAAC,IAAI,KAAK,sBAAc,CAAC,iBAAiB,CAAC,EAClD;oBACA,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC,CAAC;iBAC9D;aACF;QACH,CAAC;QAED,OAAO;YACL,uBAAuB,EAAE,qBAAqB;YAC9C,mBAAmB,EAAE,qBAAqB;YAC1C,kBAAkB,EAAE,qBAAqB;SAC1C,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
125
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/dot-notation.js
generated
vendored
Normal file
125
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/dot-notation.js
generated
vendored
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
"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("tsutils"));
|
||||
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: 'strict',
|
||||
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]) {
|
||||
var _a;
|
||||
const rules = baseRule.create(context);
|
||||
const { program, esTreeNodeToTSNodeMap } = (0, util_1.getParserServices)(context);
|
||||
const typeChecker = program.getTypeChecker();
|
||||
const allowPrivateClassPropertyAccess = options.allowPrivateClassPropertyAccess;
|
||||
const allowProtectedClassPropertyAccess = options.allowProtectedClassPropertyAccess;
|
||||
const allowIndexSignaturePropertyAccess = ((_a = options.allowIndexSignaturePropertyAccess) !== null && _a !== void 0 ? _a : false) ||
|
||||
tsutils.isCompilerOptionEnabled(program.getCompilerOptions(),
|
||||
// @ts-expect-error - TS is refining the type to never for some reason
|
||||
'noPropertyAccessFromIndexSignature');
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
var _a, _b;
|
||||
if ((allowPrivateClassPropertyAccess ||
|
||||
allowProtectedClassPropertyAccess ||
|
||||
allowIndexSignaturePropertyAccess) &&
|
||||
node.computed) {
|
||||
// for perf reasons - only fetch symbols if we have to
|
||||
const propertySymbol = typeChecker.getSymbolAtLocation(esTreeNodeToTSNodeMap.get(node.property));
|
||||
const modifierKind = (_b = (0, util_1.getModifiers)((_a = propertySymbol === null || propertySymbol === void 0 ? void 0 : propertySymbol.getDeclarations()) === null || _a === void 0 ? void 0 : _a[0])) === null || _b === void 0 ? void 0 : _b[0].kind;
|
||||
if ((allowPrivateClassPropertyAccess &&
|
||||
modifierKind === ts.SyntaxKind.PrivateKeyword) ||
|
||||
(allowProtectedClassPropertyAccess &&
|
||||
modifierKind === ts.SyntaxKind.ProtectedKeyword)) {
|
||||
return;
|
||||
}
|
||||
if (propertySymbol === undefined &&
|
||||
allowIndexSignaturePropertyAccess) {
|
||||
const objectType = typeChecker.getTypeAtLocation(esTreeNodeToTSNodeMap.get(node.object));
|
||||
const indexType = objectType
|
||||
.getNonNullableType()
|
||||
.getStringIndexType();
|
||||
if (indexType !== undefined) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
rules.MemberExpression(node);
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=dot-notation.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/dot-notation.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/dot-notation.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"dot-notation.js","sourceRoot":"","sources":["../../src/rules/dot-notation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,iDAAmC;AACnC,+CAAiC;AAMjC,kCAAsE;AACtE,iEAA8D;AAE9D,MAAM,QAAQ,GAAG,IAAA,qCAAiB,EAAC,cAAc,CAAC,CAAC;AAKnD,kBAAe,IAAA,iBAAU,EAAsB;IAC7C,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE;YACJ,WAAW,EAAE,wCAAwC;YACrD,WAAW,EAAE,QAAQ;YACrB,eAAe,EAAE,IAAI;YACrB,oBAAoB,EAAE,IAAI;SAC3B;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,aAAa,EAAE;wBACb,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,IAAI;qBACd;oBACD,YAAY,EAAE;wBACZ,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;qBACZ;oBACD,+BAA+B,EAAE;wBAC/B,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,KAAK;qBACf;oBACD,iCAAiC,EAAE;wBACjC,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,KAAK;qBACf;oBACD,iCAAiC,EAAE;wBACjC,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,KAAK;qBACf;iBACF;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO;QAC9B,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC,cAAc;QAC5C,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ;KACjC;IACD,cAAc,EAAE;QACd;YACE,+BAA+B,EAAE,KAAK;YACtC,iCAAiC,EAAE,KAAK;YACxC,iCAAiC,EAAE,KAAK;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IACE,cAAc,KAAK,SAAS;wBAC5B,iCAAiC,EACjC;wBACA,MAAM,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAC9C,qBAAqB,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CACvC,CAAC;wBACF,MAAM,SAAS,GAAG,UAAU;6BACzB,kBAAkB,EAAE;6BACpB,kBAAkB,EAAE,CAAC;wBACxB,IAAI,SAAS,KAAK,SAAS,EAAE;4BAC3B,OAAO;yBACR;qBACF;iBACF;gBACD,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
61
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/enum-utils/shared.js
generated
vendored
Normal file
61
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/enum-utils/shared.js
generated
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
"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.getEnumTypes = void 0;
|
||||
const tsutils = __importStar(require("tsutils"));
|
||||
const ts = __importStar(require("typescript"));
|
||||
const util = __importStar(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) {
|
||||
const symbol = type.getSymbol();
|
||||
if (!tsutils.isSymbolFlagSet(symbol, ts.SymbolFlags.EnumMember)) {
|
||||
return type;
|
||||
}
|
||||
return typeChecker.getTypeAtLocation(symbol.valueDeclaration.parent);
|
||||
}
|
||||
/**
|
||||
* 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 tsutils
|
||||
.unionTypeParts(type)
|
||||
.filter(subType => util.isTypeFlagSet(subType, ts.TypeFlags.EnumLiteral))
|
||||
.map(type => getBaseEnumType(typeChecker, type));
|
||||
}
|
||||
exports.getEnumTypes = getEnumTypes;
|
||||
//# sourceMappingURL=shared.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/enum-utils/shared.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,+CAAiC;AAEjC,iDAAmC;AAEnC;;;;;;;GAOG;AACH,SAAS,eAAe,CAAC,WAA2B,EAAE,IAAa;IACjE,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAG,CAAC;IACjC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE;QAC/D,OAAO,IAAI,CAAC;KACb;IAED,OAAO,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,gBAAiB,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAC1B,WAA2B,EAC3B,IAAa;IAEb,OAAO,OAAO;SACX,cAAc,CAAC,IAAI,CAAC;SACpB,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;SACxE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC;AARD,oCAQC"}
|
||||
189
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-function-return-type.js
generated
vendored
Normal file
189
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-function-return-type.js
generated
vendored
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
"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 util = __importStar(require("../util"));
|
||||
const explicitReturnTypeUtils_1 = require("../util/explicitReturnTypeUtils");
|
||||
exports.default = util.createRule({
|
||||
name: 'explicit-function-return-type',
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'Require explicit return types on functions and class methods',
|
||||
recommended: false,
|
||||
},
|
||||
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 sourceCode = context.getSourceCode();
|
||||
function isAllowedFunction(node) {
|
||||
var _a, _b;
|
||||
if (options.allowFunctionsWithoutTypeParameters && !node.typeParameters) {
|
||||
return true;
|
||||
}
|
||||
if (options.allowIIFEs && isIIFE(node)) {
|
||||
return true;
|
||||
}
|
||||
if (!((_a = options.allowedNames) === null || _a === void 0 ? void 0 : _a.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 ((_b = node.id) === null || _b === void 0 ? void 0 : _b.name) {
|
||||
funcName = node.id.name;
|
||||
}
|
||||
else if (parent) {
|
||||
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 === false) {
|
||||
funcName = parent.key.name;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!!funcName && !!options.allowedNames.includes(funcName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (node.type === utils_1.AST_NODE_TYPES.FunctionDeclaration &&
|
||||
node.id &&
|
||||
node.id.type === utils_1.AST_NODE_TYPES.Identifier &&
|
||||
!!options.allowedNames.includes(node.id.name)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isIIFE(node) {
|
||||
return node.parent.type === utils_1.AST_NODE_TYPES.CallExpression;
|
||||
}
|
||||
return {
|
||||
'ArrowFunctionExpression, FunctionExpression'(node) {
|
||||
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)(node, options, sourceCode, loc => context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId: 'missingReturnType',
|
||||
}));
|
||||
},
|
||||
FunctionDeclaration(node) {
|
||||
if (isAllowedFunction(node)) {
|
||||
return;
|
||||
}
|
||||
if (options.allowTypedFunctionExpressions && node.returnType) {
|
||||
return;
|
||||
}
|
||||
(0, explicitReturnTypeUtils_1.checkFunctionReturnType)(node, options, sourceCode, loc => context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId: 'missingReturnType',
|
||||
}));
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=explicit-function-return-type.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-function-return-type.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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,8CAAgC;AAChC,6EAIyC;AAgBzC,kBAAe,IAAI,CAAC,UAAU,CAAsB;IAClD,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,8DAA8D;YAChE,WAAW,EAAE,KAAK;SACnB;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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@typescript-eslint/eslint-plugin/dist/rules/explicit-member-accessibility.js
generated
vendored
Normal file
309
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-member-accessibility.js
generated
vendored
Normal file
|
|
@ -0,0 +1,309 @@
|
|||
"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 util = __importStar(require("../util"));
|
||||
const accessibilityLevel = {
|
||||
oneOf: [
|
||||
{
|
||||
const: 'explicit',
|
||||
description: 'Always require an accessor.',
|
||||
},
|
||||
{
|
||||
const: 'no-public',
|
||||
description: 'Require an accessor except when public.',
|
||||
},
|
||||
{
|
||||
const: 'off',
|
||||
description: 'Never check whether there is an accessor.',
|
||||
},
|
||||
],
|
||||
};
|
||||
exports.default = util.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
|
||||
recommended: false,
|
||||
},
|
||||
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,
|
||||
},
|
||||
prefixItems: [
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
accessibility: { $ref: '#/$defs/accessibilityLevel' },
|
||||
overrides: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
accessors: { $ref: '#/$defs/accessibilityLevel' },
|
||||
constructors: { $ref: '#/$defs/accessibilityLevel' },
|
||||
methods: { $ref: '#/$defs/accessibilityLevel' },
|
||||
properties: { $ref: '#/$defs/accessibilityLevel' },
|
||||
parameterProperties: {
|
||||
$ref: '#/$defs/accessibilityLevel',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
ignoredMethodNames: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
type: 'array',
|
||||
},
|
||||
},
|
||||
defaultOptions: [{ accessibility: 'explicit' }],
|
||||
create(context, [option]) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h;
|
||||
const sourceCode = context.getSourceCode();
|
||||
const baseCheck = (_a = option.accessibility) !== null && _a !== void 0 ? _a : 'explicit';
|
||||
const overrides = (_b = option.overrides) !== null && _b !== void 0 ? _b : {};
|
||||
const ctorCheck = (_c = overrides.constructors) !== null && _c !== void 0 ? _c : baseCheck;
|
||||
const accessorCheck = (_d = overrides.accessors) !== null && _d !== void 0 ? _d : baseCheck;
|
||||
const methodCheck = (_e = overrides.methods) !== null && _e !== void 0 ? _e : baseCheck;
|
||||
const propCheck = (_f = overrides.properties) !== null && _f !== void 0 ? _f : baseCheck;
|
||||
const paramPropCheck = (_g = overrides.parameterProperties) !== null && _g !== void 0 ? _g : baseCheck;
|
||||
const ignoredMethodNames = new Set((_h = option.ignoredMethodNames) !== null && _h !== void 0 ? _h : []);
|
||||
/**
|
||||
* 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 } = util.getNameFromMember(methodDefinition, sourceCode);
|
||||
if (check === 'off' || ignoredMethodNames.has(methodName)) {
|
||||
return;
|
||||
}
|
||||
if (check === 'no-public' &&
|
||||
methodDefinition.accessibility === 'public') {
|
||||
context.report({
|
||||
node: methodDefinition,
|
||||
messageId: 'unwantedPublicAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
name: methodName,
|
||||
},
|
||||
fix: getUnwantedPublicAccessibilityFixer(methodDefinition),
|
||||
});
|
||||
}
|
||||
else if (check === 'explicit' && !methodDefinition.accessibility) {
|
||||
context.report({
|
||||
node: methodDefinition,
|
||||
messageId: 'missingAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
name: methodName,
|
||||
},
|
||||
suggest: getMissingAccessibilitySuggestions(methodDefinition),
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Creates a fixer that removes a "public" keyword with following spaces
|
||||
*/
|
||||
function getUnwantedPublicAccessibilityFixer(node) {
|
||||
return function (fixer) {
|
||||
const tokens = sourceCode.getTokens(node);
|
||||
let rangeToRemove;
|
||||
for (let i = 0; i < tokens.length; i++) {
|
||||
const token = tokens[i];
|
||||
if (token.type === utils_1.AST_TOKEN_TYPES.Keyword &&
|
||||
token.value === 'public') {
|
||||
const commensAfterPublicKeyword = 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 fixer.removeRange(rangeToRemove);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Creates a fixer that adds a "public" keyword with following spaces
|
||||
*/
|
||||
function getMissingAccessibilitySuggestions(node) {
|
||||
function fix(accessibility, fixer) {
|
||||
var _a;
|
||||
if ((_a = node === null || node === void 0 ? void 0 : node.decorators) === null || _a === void 0 ? void 0 : _a.length) {
|
||||
const lastDecorator = node.decorators[node.decorators.length - 1];
|
||||
const nextToken = sourceCode.getTokenAfter(lastDecorator);
|
||||
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 } = util.getNameFromMember(propertyDefinition, sourceCode);
|
||||
if (propCheck === 'no-public' &&
|
||||
propertyDefinition.accessibility === 'public') {
|
||||
context.report({
|
||||
node: propertyDefinition,
|
||||
messageId: 'unwantedPublicAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
name: propertyName,
|
||||
},
|
||||
fix: getUnwantedPublicAccessibilityFixer(propertyDefinition),
|
||||
});
|
||||
}
|
||||
else if (propCheck === 'explicit' &&
|
||||
!propertyDefinition.accessibility) {
|
||||
context.report({
|
||||
node: 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({
|
||||
node,
|
||||
messageId: 'missingAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
name: nodeName,
|
||||
},
|
||||
suggest: getMissingAccessibilitySuggestions(node),
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'no-public': {
|
||||
if (node.accessibility === 'public' && node.readonly) {
|
||||
context.report({
|
||||
node,
|
||||
messageId: 'unwantedPublicAccessibility',
|
||||
data: {
|
||||
type: nodeType,
|
||||
name: nodeName,
|
||||
},
|
||||
fix: getUnwantedPublicAccessibilityFixer(node),
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
'MethodDefinition, TSAbstractMethodDefinition': checkMethodAccessibilityModifier,
|
||||
'PropertyDefinition, TSAbstractPropertyDefinition': checkPropertyAccessibilityModifier,
|
||||
TSParameterProperty: checkParameterPropertyAccessibilityModifier,
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=explicit-member-accessibility.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-member-accessibility.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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
396
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-module-boundary-types.js
generated
vendored
Normal file
396
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-module-boundary-types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,396 @@
|
|||
"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 scope_manager_1 = require("@typescript-eslint/scope-manager");
|
||||
const utils_1 = require("@typescript-eslint/utils");
|
||||
const util = __importStar(require("../util"));
|
||||
const explicitReturnTypeUtils_1 = require("../util/explicitReturnTypeUtils");
|
||||
exports.default = util.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",
|
||||
recommended: false,
|
||||
},
|
||||
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 expresion.',
|
||||
type: 'boolean',
|
||||
},
|
||||
// DEPRECATED - To be removed in next major
|
||||
shouldTrackReferences: {
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
defaultOptions: [
|
||||
{
|
||||
allowArgumentsExplicitlyTypedAsAny: false,
|
||||
allowDirectConstAssertionInArrowFunctions: true,
|
||||
allowedNames: [],
|
||||
allowHigherOrderFunctions: true,
|
||||
allowTypedFunctionExpressions: true,
|
||||
},
|
||||
],
|
||||
create(context, [options]) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
// tracks all of the functions we've already checked
|
||||
const checkedFunctions = new Set();
|
||||
// tracks functions that were found whilst traversing
|
||||
const foundFunctions = [];
|
||||
// all nodes visited, avoids infinite recursion for cyclic references
|
||||
// (such as class member referring to itself)
|
||||
const alreadyVisited = new Set();
|
||||
/*
|
||||
# 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(node) {
|
||||
checkNode(node.declaration);
|
||||
},
|
||||
'ExportNamedDeclaration:not([source])'(node) {
|
||||
if (node.declaration) {
|
||||
checkNode(node.declaration);
|
||||
}
|
||||
else {
|
||||
for (const specifier of node.specifiers) {
|
||||
followReference(specifier.local);
|
||||
}
|
||||
}
|
||||
},
|
||||
TSExportAssignment(node) {
|
||||
checkNode(node.expression);
|
||||
},
|
||||
'ArrowFunctionExpression, FunctionDeclaration, FunctionExpression'(node) {
|
||||
foundFunctions.push(node);
|
||||
},
|
||||
'Program:exit'() {
|
||||
for (const func of foundFunctions) {
|
||||
if (isExportedHigherOrderFunction(func)) {
|
||||
checkNode(func);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
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) {
|
||||
var _a;
|
||||
if (!node || !options.allowedNames || !options.allowedNames.length) {
|
||||
return false;
|
||||
}
|
||||
if (node.type === utils_1.AST_NODE_TYPES.VariableDeclarator ||
|
||||
node.type === utils_1.AST_NODE_TYPES.FunctionDeclaration) {
|
||||
return (((_a = node.id) === null || _a === void 0 ? void 0 : _a.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) {
|
||||
var _a;
|
||||
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 = (_a = current.parent) === null || _a === void 0 ? void 0 : _a.parent;
|
||||
continue;
|
||||
}
|
||||
if (!util.isFunction(current) ||
|
||||
!(0, explicitReturnTypeUtils_1.doesImmediatelyReturnFunctionExpression)(current)) {
|
||||
return false;
|
||||
}
|
||||
if (checkedFunctions.has(current)) {
|
||||
return true;
|
||||
}
|
||||
current = current.parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function followReference(node) {
|
||||
const scope = context.getScope();
|
||||
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:
|
||||
return checkFunctionExpression(node);
|
||||
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:
|
||||
return checkFunction(node);
|
||||
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) {
|
||||
var _a, _b, _c;
|
||||
const isConstructor = ((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) === utils_1.AST_NODE_TYPES.MethodDefinition &&
|
||||
node.parent.kind === 'constructor';
|
||||
const isSetAccessor = (((_b = node.parent) === null || _b === void 0 ? void 0 : _b.type) === utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition ||
|
||||
((_c = node.parent) === null || _c === void 0 ? void 0 : _c.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) {
|
||||
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, options, sourceCode, loc => {
|
||||
context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId: 'missingReturnType',
|
||||
});
|
||||
});
|
||||
checkParameters(node);
|
||||
}
|
||||
function checkFunction(node) {
|
||||
if (checkedFunctions.has(node)) {
|
||||
return;
|
||||
}
|
||||
checkedFunctions.add(node);
|
||||
if (isAllowedName(node) || (0, explicitReturnTypeUtils_1.ancestorHasReturnType)(node)) {
|
||||
return;
|
||||
}
|
||||
(0, explicitReturnTypeUtils_1.checkFunctionReturnType)(node, options, sourceCode, loc => {
|
||||
context.report({
|
||||
node,
|
||||
loc,
|
||||
messageId: 'missingReturnType',
|
||||
});
|
||||
});
|
||||
checkParameters(node);
|
||||
}
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=explicit-module-boundary-types.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-module-boundary-types.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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
168
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/func-call-spacing.js
generated
vendored
Normal file
168
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/func-call-spacing.js
generated
vendored
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
"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 util = __importStar(require("../util"));
|
||||
exports.default = util.createRule({
|
||||
name: 'func-call-spacing',
|
||||
meta: {
|
||||
type: 'layout',
|
||||
docs: {
|
||||
description: 'Require or disallow spacing between function identifiers and their invocations',
|
||||
recommended: false,
|
||||
extendsBaseRule: true,
|
||||
},
|
||||
fixable: 'whitespace',
|
||||
schema: {
|
||||
anyOf: [
|
||||
{
|
||||
type: 'array',
|
||||
items: [
|
||||
{
|
||||
enum: ['never'],
|
||||
},
|
||||
],
|
||||
minItems: 0,
|
||||
maxItems: 1,
|
||||
},
|
||||
{
|
||||
type: 'array',
|
||||
items: [
|
||||
{
|
||||
enum: ['always'],
|
||||
},
|
||||
{
|
||||
type: 'object',
|
||||
properties: {
|
||||
allowNewlines: {
|
||||
type: 'boolean',
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
minItems: 0,
|
||||
maxItems: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
messages: {
|
||||
unexpectedWhitespace: 'Unexpected whitespace between function name and paren.',
|
||||
unexpectedNewline: 'Unexpected newline between function name and paren.',
|
||||
missing: 'Missing space between function name and paren.',
|
||||
},
|
||||
},
|
||||
defaultOptions: ['never', {}],
|
||||
create(context, [option, config]) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
const text = sourceCode.getText();
|
||||
/**
|
||||
* Check if open space is present in a function name
|
||||
* @param {ASTNode} node node to evaluate
|
||||
* @returns {void}
|
||||
* @private
|
||||
*/
|
||||
function checkSpacing(node) {
|
||||
var _a;
|
||||
const isOptionalCall = util.isOptionalCallExpression(node);
|
||||
const closingParenToken = sourceCode.getLastToken(node);
|
||||
const lastCalleeTokenWithoutPossibleParens = sourceCode.getLastToken((_a = node.typeParameters) !== null && _a !== void 0 ? _a : node.callee);
|
||||
const openingParenToken = sourceCode.getFirstTokenBetween(lastCalleeTokenWithoutPossibleParens, closingParenToken, util.isOpeningParenToken);
|
||||
if (!openingParenToken || openingParenToken.range[1] >= node.range[1]) {
|
||||
// new expression with no parens...
|
||||
return;
|
||||
}
|
||||
const lastCalleeToken = sourceCode.getTokenBefore(openingParenToken, util.isNotOptionalChainPunctuator);
|
||||
const textBetweenTokens = text
|
||||
.slice(lastCalleeToken.range[1], openingParenToken.range[0])
|
||||
.replace(/\/\*.*?\*\//gu, '');
|
||||
const hasWhitespace = /\s/u.test(textBetweenTokens);
|
||||
const hasNewline = hasWhitespace && util.LINEBREAK_MATCHER.test(textBetweenTokens);
|
||||
if (option === 'never') {
|
||||
if (hasWhitespace) {
|
||||
return context.report({
|
||||
node,
|
||||
loc: lastCalleeToken.loc.start,
|
||||
messageId: 'unexpectedWhitespace',
|
||||
fix(fixer) {
|
||||
/*
|
||||
* Only autofix if there is no newline
|
||||
* https://github.com/eslint/eslint/issues/7787
|
||||
*/
|
||||
if (!hasNewline &&
|
||||
// don't fix optional calls
|
||||
!isOptionalCall) {
|
||||
return fixer.removeRange([
|
||||
lastCalleeToken.range[1],
|
||||
openingParenToken.range[0],
|
||||
]);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
else if (isOptionalCall) {
|
||||
// disallow:
|
||||
// foo?. ();
|
||||
// foo ?.();
|
||||
// foo ?. ();
|
||||
if (hasWhitespace || hasNewline) {
|
||||
context.report({
|
||||
node,
|
||||
loc: lastCalleeToken.loc.start,
|
||||
messageId: 'unexpectedWhitespace',
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!hasWhitespace) {
|
||||
context.report({
|
||||
node,
|
||||
loc: lastCalleeToken.loc.start,
|
||||
messageId: 'missing',
|
||||
fix(fixer) {
|
||||
return fixer.insertTextBefore(openingParenToken, ' ');
|
||||
},
|
||||
});
|
||||
}
|
||||
else if (!config.allowNewlines && hasNewline) {
|
||||
context.report({
|
||||
node,
|
||||
loc: lastCalleeToken.loc.start,
|
||||
messageId: 'unexpectedNewline',
|
||||
fix(fixer) {
|
||||
return fixer.replaceTextRange([lastCalleeToken.range[1], openingParenToken.range[0]], ' ');
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
CallExpression: checkSpacing,
|
||||
NewExpression: checkSpacing,
|
||||
};
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=func-call-spacing.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/func-call-spacing.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/func-call-spacing.js.map
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"func-call-spacing.js","sourceRoot":"","sources":["../../src/rules/func-call-spacing.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,8CAAgC;AAahC,kBAAe,IAAI,CAAC,UAAU,CAAsB;IAClD,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE;YACJ,WAAW,EACT,gFAAgF;YAClF,WAAW,EAAE,KAAK;YAClB,eAAe,EAAE,IAAI;SACtB;QACD,OAAO,EAAE,YAAY;QACrB,MAAM,EAAE;YACN,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE;wBACL;4BACE,IAAI,EAAE,CAAC,OAAO,CAAC;yBAChB;qBACF;oBACD,QAAQ,EAAE,CAAC;oBACX,QAAQ,EAAE,CAAC;iBACZ;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE;wBACL;4BACE,IAAI,EAAE,CAAC,QAAQ,CAAC;yBACjB;wBACD;4BACE,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE;gCACV,aAAa,EAAE;oCACb,IAAI,EAAE,SAAS;iCAChB;6BACF;4BACD,oBAAoB,EAAE,KAAK;yBAC5B;qBACF;oBACD,QAAQ,EAAE,CAAC;oBACX,QAAQ,EAAE,CAAC;iBACZ;aACF;SACF;QAED,QAAQ,EAAE;YACR,oBAAoB,EAClB,wDAAwD;YAC1D,iBAAiB,EAAE,qDAAqD;YACxE,OAAO,EAAE,gDAAgD;SAC1D;KACF;IACD,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;IAC7B,MAAM,CAAC,OAA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AAgB,CAC3B,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACtD,GAAG,CACJ,CAAC;wBACJ,CAAC;qBACF,CAAC,CAAC;iBACJ;aACF;QACH,CAAC;QAED,OAAO;YACL,cAAc,EAAE,YAAY;YAC5B,aAAa,EAAE,YAAY;SAC5B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
||||
410
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/indent.js
generated
vendored
Normal file
410
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/indent.js
generated
vendored
Normal file
|
|
@ -0,0 +1,410 @@
|
|||
"use strict";
|
||||
/**
|
||||
* Note this file is rather type-unsafe in its current state.
|
||||
* This is due to some really funky type conversions between different node types.
|
||||
* This is done intentionally based on the internal implementation of the base indent rule.
|
||||
*/
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment */
|
||||
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 util = __importStar(require("../util"));
|
||||
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
|
||||
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('indent');
|
||||
const KNOWN_NODES = new Set([
|
||||
// Class properties aren't yet supported by eslint...
|
||||
utils_1.AST_NODE_TYPES.PropertyDefinition,
|
||||
// ts keywords
|
||||
utils_1.AST_NODE_TYPES.TSAbstractKeyword,
|
||||
utils_1.AST_NODE_TYPES.TSAnyKeyword,
|
||||
utils_1.AST_NODE_TYPES.TSBooleanKeyword,
|
||||
utils_1.AST_NODE_TYPES.TSNeverKeyword,
|
||||
utils_1.AST_NODE_TYPES.TSNumberKeyword,
|
||||
utils_1.AST_NODE_TYPES.TSStringKeyword,
|
||||
utils_1.AST_NODE_TYPES.TSSymbolKeyword,
|
||||
utils_1.AST_NODE_TYPES.TSUndefinedKeyword,
|
||||
utils_1.AST_NODE_TYPES.TSUnknownKeyword,
|
||||
utils_1.AST_NODE_TYPES.TSVoidKeyword,
|
||||
utils_1.AST_NODE_TYPES.TSNullKeyword,
|
||||
// ts specific nodes we want to support
|
||||
utils_1.AST_NODE_TYPES.TSAbstractPropertyDefinition,
|
||||
utils_1.AST_NODE_TYPES.TSAbstractMethodDefinition,
|
||||
utils_1.AST_NODE_TYPES.TSArrayType,
|
||||
utils_1.AST_NODE_TYPES.TSAsExpression,
|
||||
utils_1.AST_NODE_TYPES.TSCallSignatureDeclaration,
|
||||
utils_1.AST_NODE_TYPES.TSConditionalType,
|
||||
utils_1.AST_NODE_TYPES.TSConstructorType,
|
||||
utils_1.AST_NODE_TYPES.TSConstructSignatureDeclaration,
|
||||
utils_1.AST_NODE_TYPES.TSDeclareFunction,
|
||||
utils_1.AST_NODE_TYPES.TSEmptyBodyFunctionExpression,
|
||||
utils_1.AST_NODE_TYPES.TSEnumDeclaration,
|
||||
utils_1.AST_NODE_TYPES.TSEnumMember,
|
||||
utils_1.AST_NODE_TYPES.TSExportAssignment,
|
||||
utils_1.AST_NODE_TYPES.TSExternalModuleReference,
|
||||
utils_1.AST_NODE_TYPES.TSFunctionType,
|
||||
utils_1.AST_NODE_TYPES.TSImportType,
|
||||
utils_1.AST_NODE_TYPES.TSIndexedAccessType,
|
||||
utils_1.AST_NODE_TYPES.TSIndexSignature,
|
||||
utils_1.AST_NODE_TYPES.TSInferType,
|
||||
utils_1.AST_NODE_TYPES.TSInterfaceBody,
|
||||
utils_1.AST_NODE_TYPES.TSInterfaceDeclaration,
|
||||
utils_1.AST_NODE_TYPES.TSInterfaceHeritage,
|
||||
utils_1.AST_NODE_TYPES.TSIntersectionType,
|
||||
utils_1.AST_NODE_TYPES.TSImportEqualsDeclaration,
|
||||
utils_1.AST_NODE_TYPES.TSLiteralType,
|
||||
utils_1.AST_NODE_TYPES.TSMappedType,
|
||||
utils_1.AST_NODE_TYPES.TSMethodSignature,
|
||||
'TSMinusToken',
|
||||
utils_1.AST_NODE_TYPES.TSModuleBlock,
|
||||
utils_1.AST_NODE_TYPES.TSModuleDeclaration,
|
||||
utils_1.AST_NODE_TYPES.TSNonNullExpression,
|
||||
utils_1.AST_NODE_TYPES.TSParameterProperty,
|
||||
'TSPlusToken',
|
||||
utils_1.AST_NODE_TYPES.TSPropertySignature,
|
||||
utils_1.AST_NODE_TYPES.TSQualifiedName,
|
||||
'TSQuestionToken',
|
||||
utils_1.AST_NODE_TYPES.TSRestType,
|
||||
utils_1.AST_NODE_TYPES.TSThisType,
|
||||
utils_1.AST_NODE_TYPES.TSTupleType,
|
||||
utils_1.AST_NODE_TYPES.TSTypeAnnotation,
|
||||
utils_1.AST_NODE_TYPES.TSTypeLiteral,
|
||||
utils_1.AST_NODE_TYPES.TSTypeOperator,
|
||||
utils_1.AST_NODE_TYPES.TSTypeParameter,
|
||||
utils_1.AST_NODE_TYPES.TSTypeParameterDeclaration,
|
||||
utils_1.AST_NODE_TYPES.TSTypeParameterInstantiation,
|
||||
utils_1.AST_NODE_TYPES.TSTypeReference,
|
||||
utils_1.AST_NODE_TYPES.TSUnionType,
|
||||
utils_1.AST_NODE_TYPES.Decorator,
|
||||
]);
|
||||
exports.default = util.createRule({
|
||||
name: 'indent',
|
||||
meta: {
|
||||
type: 'layout',
|
||||
docs: {
|
||||
description: 'Enforce consistent indentation',
|
||||
// too opinionated to be recommended
|
||||
recommended: false,
|
||||
extendsBaseRule: true,
|
||||
},
|
||||
fixable: 'whitespace',
|
||||
hasSuggestions: baseRule.meta.hasSuggestions,
|
||||
schema: baseRule.meta.schema,
|
||||
messages: baseRule.meta.messages,
|
||||
},
|
||||
defaultOptions: [
|
||||
// typescript docs and playground use 4 space indent
|
||||
4,
|
||||
{
|
||||
// typescript docs indent the case from the switch
|
||||
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-1-8.html#example-4
|
||||
SwitchCase: 1,
|
||||
flatTernaryExpressions: false,
|
||||
ignoredNodes: [],
|
||||
},
|
||||
],
|
||||
create(context, optionsWithDefaults) {
|
||||
// because we extend the base rule, have to update opts on the context
|
||||
// the context defines options as readonly though...
|
||||
const contextWithDefaults = Object.create(context, {
|
||||
options: {
|
||||
writable: false,
|
||||
configurable: false,
|
||||
value: optionsWithDefaults,
|
||||
},
|
||||
});
|
||||
const rules = baseRule.create(contextWithDefaults);
|
||||
/**
|
||||
* Converts from a TSPropertySignature to a Property
|
||||
* @param node a TSPropertySignature node
|
||||
* @param [type] the type to give the new node
|
||||
* @returns a Property node
|
||||
*/
|
||||
function TSPropertySignatureToProperty(node, type = utils_1.AST_NODE_TYPES.Property) {
|
||||
const base = {
|
||||
// indent doesn't actually use these
|
||||
key: null,
|
||||
value: null,
|
||||
// Property flags
|
||||
computed: false,
|
||||
method: false,
|
||||
kind: 'init',
|
||||
// this will stop eslint from interrogating the type literal
|
||||
shorthand: true,
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
};
|
||||
if (type === utils_1.AST_NODE_TYPES.Property) {
|
||||
return Object.assign({ type }, base);
|
||||
}
|
||||
else {
|
||||
return Object.assign({ type, static: false, readonly: false, declare: false }, base);
|
||||
}
|
||||
}
|
||||
return Object.assign({}, rules, {
|
||||
// overwrite the base rule here so we can use our KNOWN_NODES list instead
|
||||
'*:exit'(node) {
|
||||
// For nodes we care about, skip the default handling, because it just marks the node as ignored...
|
||||
if (!KNOWN_NODES.has(node.type)) {
|
||||
rules['*:exit'](node);
|
||||
}
|
||||
},
|
||||
VariableDeclaration(node) {
|
||||
// https://github.com/typescript-eslint/typescript-eslint/issues/441
|
||||
if (node.declarations.length === 0) {
|
||||
return;
|
||||
}
|
||||
return rules.VariableDeclaration(node);
|
||||
},
|
||||
TSAsExpression(node) {
|
||||
// transform it to a BinaryExpression
|
||||
return rules['BinaryExpression, LogicalExpression']({
|
||||
type: utils_1.AST_NODE_TYPES.BinaryExpression,
|
||||
operator: 'as',
|
||||
left: node.expression,
|
||||
// the first typeAnnotation includes the as token
|
||||
right: node.typeAnnotation,
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
});
|
||||
},
|
||||
TSConditionalType(node) {
|
||||
// transform it to a ConditionalExpression
|
||||
return rules.ConditionalExpression({
|
||||
type: utils_1.AST_NODE_TYPES.ConditionalExpression,
|
||||
test: {
|
||||
type: utils_1.AST_NODE_TYPES.BinaryExpression,
|
||||
operator: 'extends',
|
||||
left: node.checkType,
|
||||
right: node.extendsType,
|
||||
// location data
|
||||
range: [node.checkType.range[0], node.extendsType.range[1]],
|
||||
loc: {
|
||||
start: node.checkType.loc.start,
|
||||
end: node.extendsType.loc.end,
|
||||
},
|
||||
},
|
||||
consequent: node.trueType,
|
||||
alternate: node.falseType,
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
});
|
||||
},
|
||||
'TSEnumDeclaration, TSTypeLiteral'(node) {
|
||||
// transform it to an ObjectExpression
|
||||
return rules['ObjectExpression, ObjectPattern']({
|
||||
type: utils_1.AST_NODE_TYPES.ObjectExpression,
|
||||
properties: node.members.map(member => TSPropertySignatureToProperty(member)),
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
});
|
||||
},
|
||||
TSImportEqualsDeclaration(node) {
|
||||
// transform it to an VariableDeclaration
|
||||
// use VariableDeclaration instead of ImportDeclaration because it's essentially the same thing
|
||||
const { id, moduleReference } = node;
|
||||
return rules.VariableDeclaration({
|
||||
type: utils_1.AST_NODE_TYPES.VariableDeclaration,
|
||||
kind: 'const',
|
||||
declarations: [
|
||||
{
|
||||
type: utils_1.AST_NODE_TYPES.VariableDeclarator,
|
||||
range: [id.range[0], moduleReference.range[1]],
|
||||
loc: {
|
||||
start: id.loc.start,
|
||||
end: moduleReference.loc.end,
|
||||
},
|
||||
id: id,
|
||||
init: {
|
||||
type: utils_1.AST_NODE_TYPES.CallExpression,
|
||||
callee: {
|
||||
type: utils_1.AST_NODE_TYPES.Identifier,
|
||||
name: 'require',
|
||||
range: [
|
||||
moduleReference.range[0],
|
||||
moduleReference.range[0] + 'require'.length,
|
||||
],
|
||||
loc: {
|
||||
start: moduleReference.loc.start,
|
||||
end: {
|
||||
line: moduleReference.loc.end.line,
|
||||
column: moduleReference.loc.start.line + 'require'.length,
|
||||
},
|
||||
},
|
||||
},
|
||||
arguments: 'expression' in moduleReference
|
||||
? [moduleReference.expression]
|
||||
: [],
|
||||
// location data
|
||||
range: moduleReference.range,
|
||||
loc: moduleReference.loc,
|
||||
},
|
||||
},
|
||||
],
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
});
|
||||
},
|
||||
TSIndexedAccessType(node) {
|
||||
// convert to a MemberExpression
|
||||
return rules['MemberExpression, JSXMemberExpression, MetaProperty']({
|
||||
type: utils_1.AST_NODE_TYPES.MemberExpression,
|
||||
object: node.objectType,
|
||||
property: node.indexType,
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
optional: false,
|
||||
computed: true,
|
||||
});
|
||||
},
|
||||
TSInterfaceBody(node) {
|
||||
// transform it to an ClassBody
|
||||
return rules['BlockStatement, ClassBody']({
|
||||
type: utils_1.AST_NODE_TYPES.ClassBody,
|
||||
body: node.body.map(p => TSPropertySignatureToProperty(p, utils_1.AST_NODE_TYPES.PropertyDefinition)),
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
});
|
||||
},
|
||||
'TSInterfaceDeclaration[extends.length > 0]'(node) {
|
||||
// transform it to a ClassDeclaration
|
||||
return rules['ClassDeclaration[superClass], ClassExpression[superClass]']({
|
||||
type: utils_1.AST_NODE_TYPES.ClassDeclaration,
|
||||
body: node.body,
|
||||
id: null,
|
||||
// TODO: This is invalid, there can be more than one extends in interface
|
||||
superClass: node.extends[0].expression,
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
});
|
||||
},
|
||||
TSMappedType(node) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
const squareBracketStart = sourceCode.getTokenBefore(node.typeParameter);
|
||||
// transform it to an ObjectExpression
|
||||
return rules['ObjectExpression, ObjectPattern']({
|
||||
type: utils_1.AST_NODE_TYPES.ObjectExpression,
|
||||
properties: [
|
||||
{
|
||||
type: utils_1.AST_NODE_TYPES.Property,
|
||||
key: node.typeParameter,
|
||||
value: node.typeAnnotation,
|
||||
// location data
|
||||
range: [
|
||||
squareBracketStart.range[0],
|
||||
node.typeAnnotation
|
||||
? node.typeAnnotation.range[1]
|
||||
: squareBracketStart.range[0],
|
||||
],
|
||||
loc: {
|
||||
start: squareBracketStart.loc.start,
|
||||
end: node.typeAnnotation
|
||||
? node.typeAnnotation.loc.end
|
||||
: squareBracketStart.loc.end,
|
||||
},
|
||||
kind: 'init',
|
||||
computed: false,
|
||||
method: false,
|
||||
shorthand: false,
|
||||
},
|
||||
],
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
});
|
||||
},
|
||||
TSModuleBlock(node) {
|
||||
// transform it to a BlockStatement
|
||||
return rules['BlockStatement, ClassBody']({
|
||||
type: utils_1.AST_NODE_TYPES.BlockStatement,
|
||||
body: node.body,
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
});
|
||||
},
|
||||
TSQualifiedName(node) {
|
||||
return rules['MemberExpression, JSXMemberExpression, MetaProperty']({
|
||||
type: utils_1.AST_NODE_TYPES.MemberExpression,
|
||||
object: node.left,
|
||||
property: node.right,
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
optional: false,
|
||||
computed: false,
|
||||
});
|
||||
},
|
||||
TSTupleType(node) {
|
||||
// transform it to an ArrayExpression
|
||||
return rules['ArrayExpression, ArrayPattern']({
|
||||
type: utils_1.AST_NODE_TYPES.ArrayExpression,
|
||||
elements: node.elementTypes,
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
});
|
||||
},
|
||||
TSTypeParameterDeclaration(node) {
|
||||
if (!node.params.length) {
|
||||
return;
|
||||
}
|
||||
const [name, ...attributes] = node.params;
|
||||
// JSX is about the closest we can get because the angle brackets
|
||||
// it's not perfect but it works!
|
||||
return rules.JSXOpeningElement({
|
||||
type: utils_1.AST_NODE_TYPES.JSXOpeningElement,
|
||||
selfClosing: false,
|
||||
name: name,
|
||||
attributes: attributes,
|
||||
// location data
|
||||
parent: node.parent,
|
||||
range: node.range,
|
||||
loc: node.loc,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=indent.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/indent.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/indent.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
280
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js
generated
vendored
Normal file
280
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
"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 ban_types_1 = __importDefault(require("./ban-types"));
|
||||
const block_spacing_1 = __importDefault(require("./block-spacing"));
|
||||
const brace_style_1 = __importDefault(require("./brace-style"));
|
||||
const class_literal_property_style_1 = __importDefault(require("./class-literal-property-style"));
|
||||
const comma_dangle_1 = __importDefault(require("./comma-dangle"));
|
||||
const comma_spacing_1 = __importDefault(require("./comma-spacing"));
|
||||
const consistent_generic_constructors_1 = __importDefault(require("./consistent-generic-constructors"));
|
||||
const consistent_indexed_object_style_1 = __importDefault(require("./consistent-indexed-object-style"));
|
||||
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 func_call_spacing_1 = __importDefault(require("./func-call-spacing"));
|
||||
const indent_1 = __importDefault(require("./indent"));
|
||||
const init_declarations_1 = __importDefault(require("./init-declarations"));
|
||||
const key_spacing_1 = __importDefault(require("./key-spacing"));
|
||||
const keyword_spacing_1 = __importDefault(require("./keyword-spacing"));
|
||||
const lines_around_comment_1 = __importDefault(require("./lines-around-comment"));
|
||||
const lines_between_class_members_1 = __importDefault(require("./lines-between-class-members"));
|
||||
const member_delimiter_style_1 = __importDefault(require("./member-delimiter-style"));
|
||||
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_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_imports_1 = __importDefault(require("./no-duplicate-imports"));
|
||||
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_explicit_any_1 = __importDefault(require("./no-explicit-any"));
|
||||
const no_extra_non_null_assertion_1 = __importDefault(require("./no-extra-non-null-assertion"));
|
||||
const no_extra_parens_1 = __importDefault(require("./no-extra-parens"));
|
||||
const no_extra_semi_1 = __importDefault(require("./no-extra-semi"));
|
||||
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_implicit_any_catch_1 = __importDefault(require("./no-implicit-any-catch"));
|
||||
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_parameter_properties_1 = __importDefault(require("./no-parameter-properties"));
|
||||
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_shadow_1 = __importDefault(require("./no-shadow"));
|
||||
const no_this_alias_1 = __importDefault(require("./no-this-alias"));
|
||||
const no_throw_literal_1 = __importDefault(require("./no-throw-literal"));
|
||||
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_qualifier_1 = __importDefault(require("./no-unnecessary-qualifier"));
|
||||
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_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_member_access_1 = __importDefault(require("./no-unsafe-member-access"));
|
||||
const no_unsafe_return_1 = __importDefault(require("./no-unsafe-return"));
|
||||
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 non_nullable_type_assertion_style_1 = __importDefault(require("./non-nullable-type-assertion-style"));
|
||||
const object_curly_spacing_1 = __importDefault(require("./object-curly-spacing"));
|
||||
const padding_line_between_statements_1 = __importDefault(require("./padding-line-between-statements"));
|
||||
const parameter_properties_1 = __importDefault(require("./parameter-properties"));
|
||||
const prefer_as_const_1 = __importDefault(require("./prefer-as-const"));
|
||||
const prefer_enum_initializers_1 = __importDefault(require("./prefer-enum-initializers"));
|
||||
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_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 quotes_1 = __importDefault(require("./quotes"));
|
||||
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 semi_1 = __importDefault(require("./semi"));
|
||||
const sort_type_constituents_1 = __importDefault(require("./sort-type-constituents"));
|
||||
const sort_type_union_intersection_members_1 = __importDefault(require("./sort-type-union-intersection-members"));
|
||||
const space_before_blocks_1 = __importDefault(require("./space-before-blocks"));
|
||||
const space_before_function_paren_1 = __importDefault(require("./space-before-function-paren"));
|
||||
const space_infix_ops_1 = __importDefault(require("./space-infix-ops"));
|
||||
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 type_annotation_spacing_1 = __importDefault(require("./type-annotation-spacing"));
|
||||
const typedef_1 = __importDefault(require("./typedef"));
|
||||
const unbound_method_1 = __importDefault(require("./unbound-method"));
|
||||
const unified_signatures_1 = __importDefault(require("./unified-signatures"));
|
||||
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,
|
||||
'ban-types': ban_types_1.default,
|
||||
'block-spacing': block_spacing_1.default,
|
||||
'brace-style': brace_style_1.default,
|
||||
'class-literal-property-style': class_literal_property_style_1.default,
|
||||
'comma-dangle': comma_dangle_1.default,
|
||||
'comma-spacing': comma_spacing_1.default,
|
||||
'consistent-generic-constructors': consistent_generic_constructors_1.default,
|
||||
'consistent-indexed-object-style': consistent_indexed_object_style_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,
|
||||
'func-call-spacing': func_call_spacing_1.default,
|
||||
indent: indent_1.default,
|
||||
'init-declarations': init_declarations_1.default,
|
||||
'key-spacing': key_spacing_1.default,
|
||||
'keyword-spacing': keyword_spacing_1.default,
|
||||
'lines-around-comment': lines_around_comment_1.default,
|
||||
'lines-between-class-members': lines_between_class_members_1.default,
|
||||
'member-delimiter-style': member_delimiter_style_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-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-imports': no_duplicate_imports_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-explicit-any': no_explicit_any_1.default,
|
||||
'no-extra-non-null-assertion': no_extra_non_null_assertion_1.default,
|
||||
'no-extra-parens': no_extra_parens_1.default,
|
||||
'no-extra-semi': no_extra_semi_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-implicit-any-catch': no_implicit_any_catch_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-parameter-properties': no_parameter_properties_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-shadow': no_shadow_1.default,
|
||||
'no-this-alias': no_this_alias_1.default,
|
||||
'no-throw-literal': no_throw_literal_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-qualifier': no_unnecessary_qualifier_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-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-member-access': no_unsafe_member_access_1.default,
|
||||
'no-unsafe-return': no_unsafe_return_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,
|
||||
'non-nullable-type-assertion-style': non_nullable_type_assertion_style_1.default,
|
||||
'object-curly-spacing': object_curly_spacing_1.default,
|
||||
'padding-line-between-statements': padding_line_between_statements_1.default,
|
||||
'parameter-properties': parameter_properties_1.default,
|
||||
'prefer-as-const': prefer_as_const_1.default,
|
||||
'prefer-enum-initializers': prefer_enum_initializers_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-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,
|
||||
quotes: quotes_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,
|
||||
semi: semi_1.default,
|
||||
'sort-type-constituents': sort_type_constituents_1.default,
|
||||
'sort-type-union-intersection-members': sort_type_union_intersection_members_1.default,
|
||||
'space-before-blocks': space_before_blocks_1.default,
|
||||
'space-before-function-paren': space_before_function_paren_1.default,
|
||||
'space-infix-ops': space_infix_ops_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,
|
||||
'type-annotation-spacing': type_annotation_spacing_1.default,
|
||||
typedef: typedef_1.default,
|
||||
'unbound-method': unbound_method_1.default,
|
||||
'unified-signatures': unified_signatures_1.default,
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
49
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/init-declarations.js
generated
vendored
Normal file
49
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/init-declarations.js
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"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',
|
||||
recommended: false,
|
||||
extendsBaseRule: true,
|
||||
},
|
||||
hasSuggestions: baseRule.meta.hasSuggestions,
|
||||
schema: baseRule.meta.schema,
|
||||
messages: baseRule.meta.messages,
|
||||
},
|
||||
defaultOptions: ['always'],
|
||||
create(context, [mode]) {
|
||||
const rules = baseRule.create(context);
|
||||
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;
|
||||
}
|
||||
},
|
||||
});
|
||||
//# sourceMappingURL=init-declarations.js.map
|
||||
1
node_modules/eslint-plugin-github/node_modules/@typescript-eslint/eslint-plugin/dist/rules/init-declarations.js.map
generated
vendored
Normal file
1
node_modules/eslint-plugin-github/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,WAAW,EAAE,KAAK;YAClB,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,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEvC,OAAO;YACL,0BAA0B,CAAC,IAAkC;gBAC3D,IAAI,IAAI,KAAK,QAAQ,EAAE;oBACrB,IAAI,IAAI,CAAC,OAAO,EAAE;wBAChB,OAAO;qBACR;oBACD,IAAI,2BAA2B,CAAC,IAAI,CAAC,EAAE;wBACrC,OAAO;qBACR;iBACF;gBAED,KAAK,CAAC,0BAA0B,CAAC,CAAC,IAAI,CAAC,CAAC;YAC1C,CAAC;SACF,CAAC;QAEF,SAAS,2BAA2B,CAClC,IAAkC;YAElC,IAAI,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC;YAE3B,OAAO,QAAQ,EAAE;gBACf,IACE,QAAQ,CAAC,IAAI,KAAK,sBAAc,CAAC,mBAAmB;oBACpD,QAAQ,CAAC,OAAO,EAChB;oBACA,OAAO,IAAI,CAAC;iBACb;gBAED,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC;aAC5B;YAED,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue