Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2024-12-03 18:37:29 +00:00
parent 49f7b34c3d
commit 5261a1223f
1640 changed files with 174830 additions and 182292 deletions

View file

@ -0,0 +1,37 @@
const globals = require('globals')
const github = require('../../plugin')
const importPlugin = require('eslint-plugin-import')
const escompatPlugin = require('eslint-plugin-escompat')
const {fixupPluginRules} = require('@eslint/compat')
module.exports = {
...escompatPlugin.configs['flat/recommended'],
languageOptions: {
globals: {
...globals.browser,
},
},
plugins: {importPlugin, escompatPlugin, github: fixupPluginRules(github)},
rules: {
'escompatPlugin/no-dynamic-imports': 'off',
'github/async-currenttarget': 'error',
'github/async-preventdefault': 'error',
'github/get-attribute': 'error',
'github/no-blur': 'error',
'github/no-dataset': 'error',
'github/no-innerText': 'error',
'github/no-inner-html': 'error',
'github/unescaped-html-literal': 'error',
'github/no-useless-passive': 'error',
'github/require-passive-events': 'error',
'github/prefer-observers': 'error',
'importPlugin/no-nodejs-modules': 'error',
'no-restricted-syntax': [
'error',
{
selector: "NewExpression[callee.name='URL'][arguments.length=1]",
message: 'Please pass in `window.location.origin` as the 2nd argument to `new URL()`',
},
],
},
}

View file

@ -0,0 +1,11 @@
const github = require('../../plugin')
const {fixupPluginRules} = require('@eslint/compat')
module.exports = {
plugins: {github: fixupPluginRules(github)},
rules: {
'github/authenticity-token': 'error',
'github/js-class-name': 'error',
'github/no-d-none': 'error',
},
}

View file

@ -0,0 +1,48 @@
const github = require('../../plugin')
const jsxA11yPlugin = require('eslint-plugin-jsx-a11y')
const {fixupPluginRules} = require('@eslint/compat')
module.exports = {
...jsxA11yPlugin.flatConfigs.recommended,
languageOptions: {
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
plugins: {github: fixupPluginRules(github), jsxA11yPlugin},
rules: {
'jsxA11yPlugin/role-supports-aria-props': 'off', // Override with github/a11y-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/a11y-no-visually-hidden-interactive-element': 'error',
'github/a11y-no-title-attribute': 'error',
'github/a11y-svg-has-accessible-name': 'error',
'github/a11y-role-supports-aria-props': 'error',
'jsxA11yPlugin/no-aria-hidden-on-focusable': 'error',
'jsxA11yPlugin/no-autofocus': 'off',
'jsxA11yPlugin/anchor-ambiguous-text': [
'error',
{
words: ['this', 'more', 'read here', 'read more'],
},
],
'jsxA11yPlugin/no-interactive-element-to-noninteractive-role': [
'error',
{
tr: ['none', 'presentation'],
td: ['cell'], // TODO: Remove once https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/pull/937#issuecomment-1638128318 is addressed.
canvas: ['img'],
},
],
'jsxA11yPlugin/no-redundant-roles': [
'error',
{
nav: ['navigation'], // default in eslint-plugin-jsx-a11y
tbody: ['rowgroup'],
thead: ['rowgroup'],
},
],
},
}

View file

@ -0,0 +1,148 @@
const globals = require('globals')
const github = require('../../plugin')
const prettierPlugin = require('eslint-plugin-prettier')
const eslintComments = require('eslint-plugin-eslint-comments')
const importPlugin = require('eslint-plugin-import')
const i18nTextPlugin = require('eslint-plugin-i18n-text')
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests')
const {fixupPluginRules} = require('@eslint/compat')
module.exports = {
languageOptions: {
ecmaVersion: 6,
sourceType: 'module',
globals: {
...globals.es6,
},
},
plugins: {
prettierPlugin,
eslintComments,
importPlugin,
'i18n-text': fixupPluginRules(i18nTextPlugin),
noOnlyTestsPlugin,
github: fixupPluginRules(github),
},
rules: {
'constructor-super': 'error',
'eslintComments/disable-enable-pair': 'off',
'eslintComments/no-aggregating-enable': 'off',
'eslintComments/no-duplicate-disable': 'error',
'eslintComments/no-unlimited-disable': 'error',
'eslintComments/no-unused-disable': 'error',
'eslintComments/no-unused-enable': 'error',
'eslintComments/no-use': ['error', {allow: ['eslint', 'eslint-disable-next-line', 'eslint-env', 'globals']}],
'github/filenames-match-regex': ['error', '^[a-z0-9-]+(.[a-z0-9-]+)?$'],
'func-style': ['error', 'declaration', {allowArrowFunctions: true}],
'github/array-foreach': 'error',
'github/no-implicit-buggy-globals': 'error',
'github/no-then': 'error',
'github/no-dynamic-script-tag': 'error',
'i18n-text/no-en': ['error'],
'importPlugin/default': 'error',
'importPlugin/export': 'error',
'importPlugin/extensions': 'error',
'importPlugin/first': 'error',
'importPlugin/named': 'error',
'importPlugin/namespace': 'error',
'importPlugin/no-absolute-path': 'error',
'importPlugin/no-amd': 'error',
'importPlugin/no-anonymous-default-export': [
'error',
{
allowAnonymousClass: false,
allowAnonymousFunction: false,
allowArray: true,
allowArrowFunction: false,
allowLiteral: true,
allowObject: true,
},
],
'importPlugin/no-commonjs': 'error',
'importPlugin/no-deprecated': 'error',
'importPlugin/no-duplicates': 'error',
'importPlugin/no-dynamic-require': 'error',
'importPlugin/no-extraneous-dependencies': [0, {devDependencies: false}],
'importPlugin/no-mutable-exports': 'error',
'importPlugin/no-named-as-default': 'error',
'importPlugin/no-named-as-default-member': 'error',
'importPlugin/no-namespace': 'error',
'importPlugin/no-unresolved': 'error',
'importPlugin/no-webpack-loader-syntax': 'error',
'no-case-declarations': 'error',
'no-class-assign': 'error',
'no-compare-neg-zero': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-const-assign': 'error',
'no-constant-condition': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-delete-var': 'error',
'no-dupe-args': 'error',
'no-dupe-class-members': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': 'error',
'no-empty-character-class': 'error',
'no-empty-pattern': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-global-assign': 'error',
'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-invalid-this': 'error',
'no-irregular-whitespace': 'error',
'no-new-symbol': 'error',
'no-obj-calls': 'error',
'no-octal': 'error',
'noOnlyTestsPlugin/no-only-tests': [
'error',
{
block: ['describe', 'it', 'context', 'test', 'tape', 'fixture', 'serial', 'suite'],
},
],
'no-redeclare': 'error',
'no-regex-spaces': 'error',
'no-return-assign': 'error',
'no-self-assign': 'error',
'no-sequences': ['error'],
'no-shadow': 'error',
'no-sparse-arrays': 'error',
'no-this-before-super': 'error',
'no-throw-literal': 'error',
'no-undef': 'error',
'no-unreachable': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-unused-labels': 'error',
'no-unused-vars': 'error',
'no-useless-concat': 'error',
'no-useless-escape': 'error',
'no-var': 'error',
'object-shorthand': ['error', 'always', {avoidQuotes: true}],
'one-var': ['error', 'never'],
'prefer-const': 'error',
'prefer-promise-reject-errors': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'prettierPlugin/prettier': 'error',
'require-yield': 'error',
'use-isnan': 'error',
'valid-typeof': 'error',
camelcase: ['error', {properties: 'always'}],
eqeqeq: ['error', 'smart'],
},
settings: {
'importPlugin/resolver': {
node: {
extensions: ['.js', '.ts'],
},
},
},
}

View file

@ -0,0 +1,28 @@
const eslint = require('@eslint/js')
const tseslint = require('typescript-eslint')
const escompatPlugin = require('eslint-plugin-escompat')
const github = require('../../plugin')
const {fixupPluginRules} = require('@eslint/compat')
module.exports = tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, {
languageOptions: {
parser: tseslint.parser,
},
plugins: {'@typescript-eslint': tseslint.plugin, escompatPlugin, github: fixupPluginRules(github)},
rules: {
camelcase: 'off',
'no-unused-vars': 'off',
'no-shadow': 'off',
'no-invalid-this': 'off',
'@typescript-eslint/no-invalid-this': ['error'],
'@typescript-eslint/no-shadow': ['error'],
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/array-type': ['error', {default: 'array-simple'}],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@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',
},
})

View file

@ -30,18 +30,6 @@ module.exports = {
canvas: ['img'],
},
],
// Remove once https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/pull/950 is shipped.
'jsx-a11y/no-noninteractive-element-to-interactive-role': [
'error',
{
ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'],
li: ['menuitem', 'menuitemradio', 'menuitemcheckbox', 'option', 'row', 'tab', 'treeitem'],
table: ['grid'],
td: ['gridcell'],
fieldset: ['radiogroup', 'presentation'],
},
],
'jsx-a11y/no-redundant-roles': [
'error',
{

View file

@ -7,7 +7,7 @@ const path = require('path')
let SourceCodeFixer = null
try {
SourceCodeFixer = require('eslint/lib/linter/source-code-fixer')
} catch (e) {
} catch {
SourceCodeFixer = require('eslint/lib/util/source-code-fixer')
}
const getRuleURI = require('eslint-rule-documentation')

View file

@ -1,30 +1,15 @@
const github = require('./plugin')
const getFlatConfig = () => ({
browser: require('./configs/flat/browser'),
internal: require('./configs/flat/internal'),
recommended: require('./configs/flat/recommended'),
typescript: require('./configs/flat/typescript'),
react: require('./configs/flat/react'),
})
module.exports = {
rules: {
'a11y-no-visually-hidden-interactive-element': require('./rules/a11y-no-visually-hidden-interactive-element'),
'a11y-no-generic-link-text': require('./rules/a11y-no-generic-link-text'),
'a11y-no-title-attribute': require('./rules/a11y-no-title-attribute'),
'a11y-aria-label-is-well-formatted': require('./rules/a11y-aria-label-is-well-formatted'),
'a11y-role-supports-aria-props': require('./rules/a11y-role-supports-aria-props'),
'a11y-svg-has-accessible-name': require('./rules/a11y-svg-has-accessible-name'),
'array-foreach': require('./rules/array-foreach'),
'async-currenttarget': require('./rules/async-currenttarget'),
'async-preventdefault': require('./rules/async-preventdefault'),
'authenticity-token': require('./rules/authenticity-token'),
'get-attribute': require('./rules/get-attribute'),
'js-class-name': require('./rules/js-class-name'),
'no-blur': require('./rules/no-blur'),
'no-d-none': require('./rules/no-d-none'),
'no-dataset': require('./rules/no-dataset'),
'no-implicit-buggy-globals': require('./rules/no-implicit-buggy-globals'),
'no-inner-html': require('./rules/no-inner-html'),
'no-innerText': require('./rules/no-innerText'),
'no-dynamic-script-tag': require('./rules/no-dynamic-script-tag'),
'no-then': require('./rules/no-then'),
'no-useless-passive': require('./rules/no-useless-passive'),
'prefer-observers': require('./rules/prefer-observers'),
'require-passive-events': require('./rules/require-passive-events'),
'unescaped-html-literal': require('./rules/unescaped-html-literal'),
},
rules: github.rules,
configs: {
browser: require('./configs/browser'),
internal: require('./configs/internal'),
@ -32,4 +17,5 @@ module.exports = {
typescript: require('./configs/typescript'),
react: require('./configs/react'),
},
getFlatConfigs: getFlatConfig,
}

32
node_modules/eslint-plugin-github/lib/plugin.js generated vendored Normal file
View file

@ -0,0 +1,32 @@
const {name, version} = require('../package.json')
module.exports = {
meta: {name, version},
rules: {
'a11y-no-visually-hidden-interactive-element': require('./rules/a11y-no-visually-hidden-interactive-element'),
'a11y-no-generic-link-text': require('./rules/a11y-no-generic-link-text'),
'a11y-no-title-attribute': require('./rules/a11y-no-title-attribute'),
'a11y-aria-label-is-well-formatted': require('./rules/a11y-aria-label-is-well-formatted'),
'a11y-role-supports-aria-props': require('./rules/a11y-role-supports-aria-props'),
'a11y-svg-has-accessible-name': require('./rules/a11y-svg-has-accessible-name'),
'array-foreach': require('./rules/array-foreach'),
'async-currenttarget': require('./rules/async-currenttarget'),
'async-preventdefault': require('./rules/async-preventdefault'),
'authenticity-token': require('./rules/authenticity-token'),
'filenames-match-regex': require('./rules/filenames-match-regex'),
'get-attribute': require('./rules/get-attribute'),
'js-class-name': require('./rules/js-class-name'),
'no-blur': require('./rules/no-blur'),
'no-d-none': require('./rules/no-d-none'),
'no-dataset': require('./rules/no-dataset'),
'no-implicit-buggy-globals': require('./rules/no-implicit-buggy-globals'),
'no-inner-html': require('./rules/no-inner-html'),
'no-innerText': require('./rules/no-innerText'),
'no-dynamic-script-tag': require('./rules/no-dynamic-script-tag'),
'no-then': require('./rules/no-then'),
'no-useless-passive': require('./rules/no-useless-passive'),
'prefer-observers': require('./rules/prefer-observers'),
'require-passive-events': require('./rules/require-passive-events'),
'unescaped-html-literal': require('./rules/unescaped-html-literal'),
},
}

View file

@ -0,0 +1,51 @@
// This is adapted from https://github.com/selaux/eslint-plugin-filenames since it's no longer actively maintained
// and needed a fix for eslint v9
const path = require('path')
const parseFilename = require('../utils/parse-filename')
const getExportedName = require('../utils/get-exported-name')
const isIgnoredFilename = require('../utils/is-ignored-filename')
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'ensure filenames match a regex naming convention',
url: require('../url')(module),
},
schema: {
type: 'array',
minItems: 0,
maxItems: 1,
items: [
{
type: 'string',
},
],
},
},
create(context) {
const defaultRegexp = /^([a-z0-9]+)([A-Z][a-z0-9]+)*$/g
const conventionRegexp = context.options[0] ? new RegExp(context.options[0]) : defaultRegexp
const ignoreExporting = context.options[1] ? context.options[1] : false
return {
Program(node) {
const filename = context.getFilename()
const absoluteFilename = path.resolve(filename)
const parsed = parseFilename(absoluteFilename)
const shouldIgnore = isIgnoredFilename(filename)
const isExporting = Boolean(getExportedName(node))
const matchesRegex = conventionRegexp.test(parsed.name)
if (shouldIgnore) return
if (ignoreExporting && isExporting) return
if (!matchesRegex) {
context.report(node, "Filename '{{name}}' does not match the regex naming convention.", {
name: parsed.base,
})
}
},
}
},
}

View file

@ -9,9 +9,10 @@ module.exports = {
},
create(context) {
const sourceCode = context.sourceCode ?? context.getSourceCode()
return {
Program() {
const scope = context.getScope()
Program(node) {
const scope = sourceCode.getScope(node) ? sourceCode.getScope(node) : context.getScope()
for (const variable of scope.variables) {
if (variable.writeable) {

View file

@ -0,0 +1,37 @@
function getNodeName(node, options) {
const op = options || []
if (node.type === 'Identifier') {
return node.name
}
if (node.id && node.id.type === 'Identifier') {
return node.id.name
}
if (op[2] && node.type === 'CallExpression' && node.callee.type === 'Identifier') {
return node.callee.name
}
}
module.exports = function getExportedName(programNode, options) {
for (let i = 0; i < programNode.body.length; i += 1) {
const node = programNode.body[i]
if (node.type === 'ExportDefaultDeclaration') {
return getNodeName(node.declaration, options)
}
if (
node.type === 'ExpressionStatement' &&
node.expression.type === 'AssignmentExpression' &&
node.expression.left.type === 'MemberExpression' &&
node.expression.left.object.type === 'Identifier' &&
node.expression.left.object.name === 'module' &&
node.expression.left.property.type === 'Identifier' &&
node.expression.left.property.name === 'exports'
) {
return getNodeName(node.expression.right, options)
}
}
}

View file

@ -0,0 +1,5 @@
const ignoredFilenames = ['<text>', '<input>']
module.exports = function isIgnoredFilename(filename) {
return ignoredFilenames.indexOf(filename) !== -1
}

View file

@ -0,0 +1,12 @@
const path = require('path')
module.exports = function parseFilename(filename) {
const ext = path.extname(filename)
return {
dir: path.dirname(filename),
base: path.basename(filename),
ext,
name: path.basename(filename, ext),
}
}