initial commit of actions
This commit is contained in:
commit
949ece5785
44660 changed files with 12034344 additions and 0 deletions
26
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/configs/browser.js
generated
vendored
Normal file
26
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/configs/browser.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
module.exports = {
|
||||
env: {
|
||||
browser: true
|
||||
},
|
||||
plugins: ['github'],
|
||||
rules: {
|
||||
'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/unescaped-html-literal': 'error',
|
||||
'github/no-useless-passive': 'error',
|
||||
'github/require-passive-events': 'error',
|
||||
'github/prefer-observers': 'error',
|
||||
'import/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()`'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
8
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/configs/internal.js
generated
vendored
Normal file
8
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/configs/internal.js
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = {
|
||||
plugins: ['github'],
|
||||
rules: {
|
||||
'github/authenticity-token': 'error',
|
||||
'github/js-class-name': 'error',
|
||||
'github/no-d-none': 'error'
|
||||
}
|
||||
}
|
||||
134
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/configs/recommended.js
generated
vendored
Normal file
134
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/configs/recommended.js
generated
vendored
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
module.exports = {
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
ecmaVersion: 6
|
||||
},
|
||||
sourceType: 'module'
|
||||
},
|
||||
env: {
|
||||
es6: true
|
||||
},
|
||||
plugins: ['github', 'prettier', 'eslint-comments', 'import', 'filenames', 'i18n-text', 'no-only-tests'],
|
||||
rules: {
|
||||
'constructor-super': 'error',
|
||||
'eslint-comments/disable-enable-pair': 'off',
|
||||
'eslint-comments/no-aggregating-enable': 'off',
|
||||
'eslint-comments/no-duplicate-disable': 'error',
|
||||
'eslint-comments/no-unlimited-disable': 'error',
|
||||
'eslint-comments/no-unused-disable': 'error',
|
||||
'eslint-comments/no-unused-enable': 'error',
|
||||
'eslint-comments/no-use': ['error', {allow: ['eslint', 'eslint-disable-next-line', 'eslint-env', 'globals']}],
|
||||
'filenames/match-regex': ['error', '^[a-z0-9-]+(.d)?$'],
|
||||
'func-style': ['error', 'declaration', {allowArrowFunctions: true}],
|
||||
'github/array-foreach': 'error',
|
||||
'github/no-implicit-buggy-globals': 'error',
|
||||
'github/no-then': 'error',
|
||||
'i18n-text/no-en': ['error'],
|
||||
'import/default': 'error',
|
||||
'import/export': 'error',
|
||||
'import/extensions': 'error',
|
||||
'import/first': 'error',
|
||||
'import/named': 'error',
|
||||
'import/namespace': 'error',
|
||||
'import/no-absolute-path': 'error',
|
||||
'import/no-amd': 'error',
|
||||
'import/no-anonymous-default-export': [
|
||||
'error',
|
||||
{
|
||||
allowAnonymousClass: false,
|
||||
allowAnonymousFunction: false,
|
||||
allowArray: true,
|
||||
allowArrowFunction: false,
|
||||
allowLiteral: true,
|
||||
allowObject: true
|
||||
}
|
||||
],
|
||||
'import/no-commonjs': 'error',
|
||||
'import/no-deprecated': 'error',
|
||||
'import/no-duplicates': 'error',
|
||||
'import/no-dynamic-require': 'error',
|
||||
'import/no-extraneous-dependencies': [0, {devDependencies: false}],
|
||||
'import/no-mutable-exports': 'error',
|
||||
'import/no-named-as-default': 'error',
|
||||
'import/no-named-as-default-member': 'error',
|
||||
'import/no-namespace': 'error',
|
||||
'import/no-unresolved': 'error',
|
||||
'import/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',
|
||||
'no-only-tests/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',
|
||||
'prettier/prettier': 'error',
|
||||
'require-yield': 'error',
|
||||
'sort-imports': 'error',
|
||||
'use-isnan': 'error',
|
||||
'valid-typeof': 'error',
|
||||
camelcase: ['error', {properties: 'always'}],
|
||||
eqeqeq: ['error', 'smart']
|
||||
},
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
node: {
|
||||
extensions: ['.js', '.ts']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/configs/typescript.js
generated
vendored
Normal file
17
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/configs/typescript.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
module.exports = {
|
||||
extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint', 'github'],
|
||||
rules: {
|
||||
camelcase: 'off',
|
||||
'no-unused-vars': 'off',
|
||||
'no-shadow': 'off',
|
||||
'@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'
|
||||
}
|
||||
}
|
||||
87
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/formatters/stylish-fixes.js
generated
vendored
Normal file
87
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/formatters/stylish-fixes.js
generated
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
'use strict'
|
||||
|
||||
const childProcess = require('child_process')
|
||||
const fs = require('fs')
|
||||
const os = require('os')
|
||||
const path = require('path')
|
||||
let SourceCodeFixer = null
|
||||
try {
|
||||
SourceCodeFixer = require('eslint/lib/linter/source-code-fixer')
|
||||
} catch (e) {
|
||||
SourceCodeFixer = require('eslint/lib/util/source-code-fixer')
|
||||
}
|
||||
const getRuleURI = require('eslint-rule-documentation')
|
||||
|
||||
// eslint-disable-next-line eslint-plugin/prefer-object-rule
|
||||
module.exports = function (results) {
|
||||
let output = '\n'
|
||||
let errors = 0
|
||||
let warnings = 0
|
||||
const rootPath = process.cwd()
|
||||
|
||||
for (const result of results) {
|
||||
const messages = result.messages
|
||||
|
||||
if (messages.length === 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
errors += result.errorCount
|
||||
warnings += result.warningCount
|
||||
|
||||
const relativePath = path.relative(rootPath, result.filePath)
|
||||
|
||||
output += `${relativePath}\n`
|
||||
|
||||
for (const message of messages) {
|
||||
output += `${message.line}:${message.column} ${message.ruleId || ''}`
|
||||
if (message.ruleId) {
|
||||
const ruleURI = getRuleURI(message.ruleId)
|
||||
if (ruleURI.found) {
|
||||
output += ` (${ruleURI.url})`
|
||||
}
|
||||
}
|
||||
output += `\n\t${message.message}\n`
|
||||
}
|
||||
|
||||
if (messages.some(msg => msg.fix)) {
|
||||
const fixResult = SourceCodeFixer.applyFixes(result.source, messages)
|
||||
output += `\n\n$ eslint --fix ${relativePath}\n`
|
||||
output += diff(result.source, fixResult.output)
|
||||
}
|
||||
|
||||
output += '\n\n'
|
||||
}
|
||||
|
||||
const total = errors + warnings
|
||||
|
||||
if (total > 0) {
|
||||
output += [
|
||||
'\u2716 ',
|
||||
total,
|
||||
pluralize(' problem', total),
|
||||
' (',
|
||||
errors,
|
||||
pluralize(' error', errors),
|
||||
', ',
|
||||
warnings,
|
||||
pluralize(' warning', warnings),
|
||||
')\n'
|
||||
].join('')
|
||||
}
|
||||
|
||||
return total > 0 ? output : ''
|
||||
}
|
||||
|
||||
function pluralize(word, count) {
|
||||
return count === 1 ? word : `${word}s`
|
||||
}
|
||||
|
||||
function diff(a, b) {
|
||||
const aPath = path.join(os.tmpdir(), 'a.js')
|
||||
const bPath = path.join(os.tmpdir(), 'p.js')
|
||||
fs.writeFileSync(aPath, a, {encoding: 'utf8'})
|
||||
fs.writeFileSync(bPath, b, {encoding: 'utf8'})
|
||||
const result = childProcess.spawnSync('diff', ['-U5', aPath, bPath], {encoding: 'utf8'})
|
||||
return result.stdout.split('\n').slice(2).join('\n')
|
||||
}
|
||||
26
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/index.js
generated
vendored
Normal file
26
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
module.exports = {
|
||||
rules: {
|
||||
'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-innerText': require('./rules/no-innerText'),
|
||||
'no-then': require('./rules/no-then'),
|
||||
'unescaped-html-literal': require('./rules/unescaped-html-literal'),
|
||||
'no-useless-passive': require('./rules/no-useless-passive'),
|
||||
'prefer-observers': require('./rules/prefer-observers'),
|
||||
'require-passive-events': require('./rules/require-passive-events')
|
||||
},
|
||||
configs: {
|
||||
internal: require('./configs/internal'),
|
||||
browser: require('./configs/browser'),
|
||||
recommended: require('./configs/recommended'),
|
||||
typescript: require('./configs/typescript')
|
||||
}
|
||||
}
|
||||
20
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/array-foreach.js
generated
vendored
Normal file
20
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/array-foreach.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'enforce `for..of` loops over `Array.forEach`',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
CallExpression(node) {
|
||||
if (node.callee.property && node.callee.property.name === 'forEach') {
|
||||
context.report({node, message: 'Prefer for...of instead of Array.forEach'})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/async-currenttarget.js
generated
vendored
Normal file
28
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/async-currenttarget.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow `event.currentTarget` calls inside of async functions',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const scopeDidWait = new WeakSet()
|
||||
|
||||
return {
|
||||
AwaitExpression() {
|
||||
scopeDidWait.add(context.getScope(), true)
|
||||
},
|
||||
MemberExpression(node) {
|
||||
if (node.property && node.property.name === 'currentTarget') {
|
||||
const scope = context.getScope()
|
||||
if (scope.block.async && scopeDidWait.has(scope)) {
|
||||
context.report({node, message: 'event.currentTarget inside an async function is error prone'})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/async-preventdefault.js
generated
vendored
Normal file
28
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/async-preventdefault.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow `event.preventDefault` calls inside of async functions',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const scopeDidWait = new WeakSet()
|
||||
|
||||
return {
|
||||
AwaitExpression() {
|
||||
scopeDidWait.add(context.getScope(), true)
|
||||
},
|
||||
CallExpression(node) {
|
||||
if (node.callee.property && node.callee.property.name === 'preventDefault') {
|
||||
const scope = context.getScope()
|
||||
if (scope.block.async && scopeDidWait.has(scope)) {
|
||||
context.report({node, message: 'event.preventDefault() inside an async function is error prone'})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
30
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/authenticity-token.js
generated
vendored
Normal file
30
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/authenticity-token.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow usage of CSRF tokens in JavaScript',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
function checkAuthenticityTokenUsage(node, str) {
|
||||
if (str.includes('authenticity_token')) {
|
||||
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.'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
Literal(node) {
|
||||
if (typeof node.value === 'string') {
|
||||
checkAuthenticityTokenUsage(node, node.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
53
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/get-attribute.js
generated
vendored
Normal file
53
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/get-attribute.js
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
const svgElementAttributes = require('svg-element-attributes')
|
||||
|
||||
const attributeCalls = /^(get|has|set|remove)Attribute$/
|
||||
const validAttributeName = /^[a-z][a-z0-9-]*$/
|
||||
|
||||
// these are common SVG attributes that *must* have the correct case to work
|
||||
const camelCaseAttributes = Object.values(svgElementAttributes)
|
||||
.reduce((all, elementAttrs) => all.concat(elementAttrs), [])
|
||||
.filter(name => !validAttributeName.test(name))
|
||||
|
||||
const validSVGAttributeSet = new Set(camelCaseAttributes)
|
||||
|
||||
// lowercase variants of camelCase SVG attributes are probably an error
|
||||
const invalidSVGAttributeSet = new Set(camelCaseAttributes.map(name => name.toLowerCase()))
|
||||
|
||||
function isValidAttribute(name) {
|
||||
return validSVGAttributeSet.has(name) || (validAttributeName.test(name) && !invalidSVGAttributeSet.has(name))
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow wrong usage of attribute names',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
fixable: 'code',
|
||||
schema: []
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
CallExpression(node) {
|
||||
if (!node.callee.property) return
|
||||
|
||||
const calleeName = node.callee.property.name
|
||||
if (!attributeCalls.test(calleeName)) return
|
||||
|
||||
const attributeNameNode = node.arguments[0]
|
||||
if (!attributeNameNode) return
|
||||
|
||||
if (!isValidAttribute(attributeNameNode.value)) {
|
||||
context.report({
|
||||
node: attributeNameNode,
|
||||
message: 'Attributes should be lowercase and hyphen separated, or part of the SVG whitelist.',
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(attributeNameNode, `'${attributeNameNode.value.toLowerCase()}'`)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
57
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/js-class-name.js
generated
vendored
Normal file
57
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/js-class-name.js
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'enforce a naming convention for js- prefixed classes',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const allJsClassNameRegexp = /\bjs-[_a-zA-Z0-9-]*/g
|
||||
const validJsClassNameRegexp = /^js(-[a-z0-9]+)+$/g
|
||||
const endWithJsClassNameRegexp = /\bjs-[_a-zA-Z0-9-]*$/g
|
||||
|
||||
function checkStringFormat(node, str) {
|
||||
const matches = str.match(allJsClassNameRegexp) || []
|
||||
for (const match of matches) {
|
||||
if (!match.match(validJsClassNameRegexp)) {
|
||||
context.report({node, message: 'js- class names should be lowercase and only contain dashes.'})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkStringEndsWithJSClassName(node, str) {
|
||||
if (str.match(endWithJsClassNameRegexp)) {
|
||||
context.report({node, message: 'js- class names should be statically defined.'})
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
Literal(node) {
|
||||
if (typeof node.value === 'string') {
|
||||
checkStringFormat(node, node.value)
|
||||
|
||||
if (
|
||||
node.parent &&
|
||||
node.parent.type === 'BinaryExpression' &&
|
||||
node.parent.operator === '+' &&
|
||||
node.parent.left.value
|
||||
) {
|
||||
checkStringEndsWithJSClassName(node.parent.left, node.parent.left.value)
|
||||
}
|
||||
}
|
||||
},
|
||||
TemplateLiteral(node) {
|
||||
for (const quasi of node.quasis) {
|
||||
checkStringFormat(quasi, quasi.value.raw)
|
||||
|
||||
if (quasi.tail === false) {
|
||||
checkStringEndsWithJSClassName(quasi, quasi.value.raw)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
19
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-blur.js
generated
vendored
Normal file
19
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-blur.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow usage of `Element.prototype.blur()`',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
CallExpression(node) {
|
||||
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.'})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
31
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-d-none.js
generated
vendored
Normal file
31
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-d-none.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow usage the `d-none` CSS class',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
CallExpression(node) {
|
||||
if (
|
||||
node.callee.type === 'MemberExpression' &&
|
||||
node.callee.object.property &&
|
||||
node.callee.object.property.name === 'classList'
|
||||
) {
|
||||
const invalidArgument = node.arguments.some(arg => {
|
||||
return arg.type === 'Literal' && arg.value === 'd-none'
|
||||
})
|
||||
if (invalidArgument) {
|
||||
context.report({
|
||||
node,
|
||||
message: 'Prefer hidden property to d-none class'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
20
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-dataset.js
generated
vendored
Normal file
20
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-dataset.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'enforce usage of `Element.prototype.getAttribute` instead of `Element.prototype.datalist`',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
if (node.property && node.property.name === 'dataset') {
|
||||
context.report({node, message: "Use getAttribute('data-your-attribute') instead of dataset."})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
35
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-implicit-buggy-globals.js
generated
vendored
Normal file
35
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-implicit-buggy-globals.js
generated
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow implicit global variables',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
Program() {
|
||||
const scope = context.getScope()
|
||||
|
||||
for (const variable of scope.variables) {
|
||||
if (variable.writeable) {
|
||||
return
|
||||
}
|
||||
|
||||
for (const def of variable.defs) {
|
||||
if (
|
||||
def.type === 'FunctionName' ||
|
||||
def.type === 'ClassName' ||
|
||||
(def.type === 'Variable' && def.parent.kind === 'const') ||
|
||||
(def.type === 'Variable' && def.parent.kind === 'let')
|
||||
) {
|
||||
context.report({node: def.node, message: 'Implicit global variable, assign as global property instead.'})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
30
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-innerText.js
generated
vendored
Normal file
30
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-innerText.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow `Element.prototype.innerText` in favor of `Element.prototype.textContent`',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
fixable: 'code',
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
if (node.property && node.property.name === 'innerText') {
|
||||
context.report({
|
||||
meta: {
|
||||
fixable: 'code'
|
||||
},
|
||||
node: node.property,
|
||||
message: 'Prefer textContent to innerText',
|
||||
fix(fixer) {
|
||||
return fixer.replaceText(node.property, 'textContent')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
22
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-then.js
generated
vendored
Normal file
22
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-then.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'enforce using `async/await` syntax over Promises',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
MemberExpression(node) {
|
||||
if (node.property && node.property.name === 'then') {
|
||||
context.report({node: node.property, message: 'Prefer async/await to Promise.then()'})
|
||||
} else if (node.property && node.property.name === 'catch') {
|
||||
context.report({node: node.property, message: 'Prefer async/await to Promise.catch()'})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-useless-passive.js
generated
vendored
Normal file
51
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/no-useless-passive.js
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
const passiveEventListenerNames = new Set(['touchstart', 'touchmove', 'wheel', 'mousewheel'])
|
||||
|
||||
const propIsPassiveTrue = prop => prop.key && prop.key.name === 'passive' && prop.value && prop.value.value === true
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'disallow marking a event handler as passive when it has no effect',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
fixable: 'code',
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
['CallExpression[callee.property.name="addEventListener"]']: function (node) {
|
||||
const [name, listener, options] = node.arguments
|
||||
if (name.type !== 'Literal') return
|
||||
if (passiveEventListenerNames.has(name.value)) return
|
||||
if (options && options.type === 'ObjectExpression') {
|
||||
const i = options.properties.findIndex(propIsPassiveTrue)
|
||||
if (i === -1) return
|
||||
const passiveProp = options.properties[i]
|
||||
const l = options.properties.length
|
||||
const source = context.getSourceCode()
|
||||
context.report({
|
||||
node: passiveProp,
|
||||
message: `"${name.value}" event listener is not cancellable and so \`passive: true\` does nothing.`,
|
||||
fix(fixer) {
|
||||
const removals = []
|
||||
if (l === 1) {
|
||||
removals.push(options)
|
||||
removals.push(...source.getTokensBetween(listener, options))
|
||||
} else {
|
||||
removals.push(passiveProp)
|
||||
if (i > 0) {
|
||||
removals.push(...source.getTokensBetween(options.properties[i - 1], passiveProp))
|
||||
} else {
|
||||
removals.push(...source.getTokensBetween(passiveProp, options.properties[i + 1]))
|
||||
}
|
||||
}
|
||||
return removals.map(t => fixer.remove(t))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/prefer-observers.js
generated
vendored
Normal file
28
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/prefer-observers.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
const observerMap = {
|
||||
scroll: 'IntersectionObserver',
|
||||
resize: 'ResizeObserver'
|
||||
}
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'disallow poorly performing event listeners',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
['CallExpression[callee.property.name="addEventListener"]']: function (node) {
|
||||
const [name] = node.arguments
|
||||
if (name.type !== 'Literal') return
|
||||
if (!(name.value in observerMap)) return
|
||||
context.report({
|
||||
node,
|
||||
message: `Avoid using "${name.value}" event listener. Consider using ${observerMap[name.value]} instead`
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/require-passive-events.js
generated
vendored
Normal file
27
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/require-passive-events.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
const passiveEventListenerNames = new Set(['touchstart', 'touchmove', 'wheel', 'mousewheel'])
|
||||
|
||||
const propIsPassiveTrue = prop => prop.key && prop.key.name === 'passive' && prop.value && prop.value.value === true
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'enforce marking high frequency event handlers as passive',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
['CallExpression[callee.property.name="addEventListener"]']: function (node) {
|
||||
const [name, listener, options] = node.arguments
|
||||
if (!listener) return
|
||||
if (name.type !== 'Literal') return
|
||||
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\``})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/unescaped-html-literal.js
generated
vendored
Normal file
36
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/rules/unescaped-html-literal.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
module.exports = {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: {
|
||||
description: 'disallow unesaped HTML literals',
|
||||
url: require('../url')(module)
|
||||
},
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const htmlOpenTag = /^<[a-zA-Z]/
|
||||
const message = 'Unescaped HTML literal. Use html`` tag template literal for secure escaping.'
|
||||
|
||||
return {
|
||||
Literal(node) {
|
||||
if (!htmlOpenTag.test(node.value)) return
|
||||
|
||||
context.report({
|
||||
node,
|
||||
message
|
||||
})
|
||||
},
|
||||
TemplateLiteral(node) {
|
||||
if (!htmlOpenTag.test(node.quasis[0].value.raw)) return
|
||||
|
||||
if (!node.parent.tag || node.parent.tag.name !== 'html') {
|
||||
context.report({
|
||||
node,
|
||||
message
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
10
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/url.js
generated
vendored
Normal file
10
github/codeql-action-v1/node_modules/eslint-plugin-github/lib/url.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
const {homepage, version} = require('../package.json')
|
||||
const path = require('path')
|
||||
// eslint-disable-next-line eslint-plugin/prefer-object-rule
|
||||
module.exports = ({id}) => {
|
||||
const url = new URL(homepage)
|
||||
const rule = path.basename(id, '.js')
|
||||
url.hash = ''
|
||||
url.pathname += `/blob/v${version}/docs/rules/${rule}.md`
|
||||
return url.toString()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue