mirror of
https://github.com/github/codeql-action.git
synced 2025-12-24 08:10:06 +08:00
Update checked-in dependencies
This commit is contained in:
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]()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user