From 4a0d3378b1f7fa992109d809bb667661bdc14418 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 11 Aug 2021 13:02:43 +0000 Subject: [PATCH] Update checked-in dependencies --- node_modules/.package-lock.json | 27 ++++- .../lib/configs/browser.js | 10 +- .../lib/configs/recommended.js | 20 +++- .../eslint-plugin-github/package.json | 5 +- .../eslint-plugin-i18n-text/.eslintrc | 18 +++ .../eslint-plugin-i18n-text/.prettierrc | 6 + .../eslint-plugin-i18n-text/.travis.yml | 3 + node_modules/eslint-plugin-i18n-text/LICENSE | 20 ++++ .../eslint-plugin-i18n-text/README.md | 61 +++++++++++ node_modules/eslint-plugin-i18n-text/index.js | 7 ++ .../eslint-plugin-i18n-text/package.json | 27 +++++ .../eslint-plugin-i18n-text/rules/no-en.js | 96 ++++++++++++++++ .../eslint-plugin-i18n-text/tests/no-en.js | 103 ++++++++++++++++++ .../.github/workflows/nodejs.yml | 25 +++++ .../.github/workflows/npmpublish.yml | 54 +++++++++ .../eslint-plugin-no-only-tests/CHANGELOG.md | 57 ++++++++++ .../eslint-plugin-no-only-tests/LICENSE | 21 ++++ .../eslint-plugin-no-only-tests/README.md | 75 +++++++++++++ .../eslint-plugin-no-only-tests/index.js | 7 ++ .../eslint-plugin-no-only-tests/package.json | 36 ++++++ .../rules/no-only-tests.js | 88 +++++++++++++++ 21 files changed, 760 insertions(+), 6 deletions(-) create mode 100644 node_modules/eslint-plugin-i18n-text/.eslintrc create mode 100644 node_modules/eslint-plugin-i18n-text/.prettierrc create mode 100644 node_modules/eslint-plugin-i18n-text/.travis.yml create mode 100644 node_modules/eslint-plugin-i18n-text/LICENSE create mode 100644 node_modules/eslint-plugin-i18n-text/README.md create mode 100644 node_modules/eslint-plugin-i18n-text/index.js create mode 100644 node_modules/eslint-plugin-i18n-text/package.json create mode 100644 node_modules/eslint-plugin-i18n-text/rules/no-en.js create mode 100644 node_modules/eslint-plugin-i18n-text/tests/no-en.js create mode 100644 node_modules/eslint-plugin-no-only-tests/.github/workflows/nodejs.yml create mode 100644 node_modules/eslint-plugin-no-only-tests/.github/workflows/npmpublish.yml create mode 100644 node_modules/eslint-plugin-no-only-tests/CHANGELOG.md create mode 100644 node_modules/eslint-plugin-no-only-tests/LICENSE create mode 100644 node_modules/eslint-plugin-no-only-tests/README.md create mode 100644 node_modules/eslint-plugin-no-only-tests/index.js create mode 100644 node_modules/eslint-plugin-no-only-tests/package.json create mode 100644 node_modules/eslint-plugin-no-only-tests/rules/no-only-tests.js diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 88b0ef30a..228bef8ed 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -2270,16 +2270,19 @@ } }, "node_modules/eslint-plugin-github": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-4.1.5.tgz", - "integrity": "sha512-fY+3C8914Efqzmb6ODvL0ZNjv8xxLkwmUasYZ189IY1gL7AxFE9CVED+MZA8B1e+OZtnfTdrQR036t5AYoun0A==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-4.2.0.tgz", + "integrity": "sha512-YAzCgSKFpZK7e3YVBKNmsVqHG5+/+cFWXKx8gi2zj96vlFA665mHRhHAMTNuPQmY22Lx4c5Xq26KIRiVLQMmqQ==", "dev": true, "dependencies": { "@typescript-eslint/eslint-plugin": "^4.20.0", "@typescript-eslint/parser": "^4.20.0", "eslint-config-prettier": ">=8.0.0", "eslint-plugin-eslint-comments": "^3.2.0", + "eslint-plugin-filenames": "^1.3.2", + "eslint-plugin-i18n-text": "^1.0.1", "eslint-plugin-import": "^2.22.1", + "eslint-plugin-no-only-tests": "^2.6.0", "eslint-plugin-prettier": "^3.3.1", "eslint-rule-documentation": ">=1.0.0", "prettier": "^2.2.1", @@ -2292,6 +2295,15 @@ "eslint": "^7.23.0" } }, + "node_modules/eslint-plugin-i18n-text": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-i18n-text/-/eslint-plugin-i18n-text-1.0.1.tgz", + "integrity": "sha512-3G3UetST6rdqhqW9SfcfzNYMpQXS7wNkJvp6dsXnjzGiku6Iu5hl3B0kmk6lIcFPwYjhQIY+tXVRtK9TlGT7RA==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, "node_modules/eslint-plugin-import": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.24.0.tgz", @@ -2412,6 +2424,15 @@ "node": ">=0.10.0" } }, + "node_modules/eslint-plugin-no-only-tests": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-no-only-tests/-/eslint-plugin-no-only-tests-2.6.0.tgz", + "integrity": "sha512-T9SmE/g6UV1uZo1oHAqOvL86XWl7Pl2EpRpnLI8g/bkJu+h7XBCB+1LnubRZ2CUQXj805vh4/CYZdnqtVaEo2Q==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, "node_modules/eslint-plugin-prettier": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.4.0.tgz", diff --git a/node_modules/eslint-plugin-github/lib/configs/browser.js b/node_modules/eslint-plugin-github/lib/configs/browser.js index c2e5c4467..acebee6dc 100644 --- a/node_modules/eslint-plugin-github/lib/configs/browser.js +++ b/node_modules/eslint-plugin-github/lib/configs/browser.js @@ -13,6 +13,14 @@ module.exports = { 'github/unescaped-html-literal': 'error', 'github/no-useless-passive': 'error', 'github/require-passive-events': 'error', - 'github/prefer-observers': '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()`' + } + ] } } diff --git a/node_modules/eslint-plugin-github/lib/configs/recommended.js b/node_modules/eslint-plugin-github/lib/configs/recommended.js index c164a3988..3797544de 100644 --- a/node_modules/eslint-plugin-github/lib/configs/recommended.js +++ b/node_modules/eslint-plugin-github/lib/configs/recommended.js @@ -8,7 +8,7 @@ module.exports = { env: { es6: true }, - plugins: ['github', 'prettier', 'eslint-comments', 'import'], + plugins: ['github', 'prettier', 'eslint-comments', 'import', 'filenames', 'i18n-text', 'no-only-tests'], rules: { 'constructor-super': 'error', 'eslint-comments/disable-enable-pair': 'off', @@ -18,16 +18,20 @@ module.exports = { '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', { @@ -39,12 +43,17 @@ module.exports = { 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', @@ -76,10 +85,17 @@ module.exports = { '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', @@ -94,6 +110,7 @@ module.exports = { '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', @@ -101,6 +118,7 @@ module.exports = { 'prefer-template': 'error', 'prettier/prettier': 'error', 'require-yield': 'error', + 'sort-imports': 'error', 'use-isnan': 'error', 'valid-typeof': 'error', camelcase: ['error', {properties: 'always'}], diff --git a/node_modules/eslint-plugin-github/package.json b/node_modules/eslint-plugin-github/package.json index e18bd5f31..a8fea7ace 100644 --- a/node_modules/eslint-plugin-github/package.json +++ b/node_modules/eslint-plugin-github/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-github", - "version": "4.1.5", + "version": "4.2.0", "description": "An opinionated collection of ESLint shared configs and rules used by GitHub.", "main": "lib/index.js", "entries": [ @@ -29,7 +29,10 @@ "@typescript-eslint/parser": "^4.20.0", "eslint-config-prettier": ">=8.0.0", "eslint-plugin-eslint-comments": "^3.2.0", + "eslint-plugin-filenames": "^1.3.2", + "eslint-plugin-i18n-text": "^1.0.1", "eslint-plugin-import": "^2.22.1", + "eslint-plugin-no-only-tests": "^2.6.0", "eslint-plugin-prettier": "^3.3.1", "eslint-rule-documentation": ">=1.0.0", "prettier": "^2.2.1", diff --git a/node_modules/eslint-plugin-i18n-text/.eslintrc b/node_modules/eslint-plugin-i18n-text/.eslintrc new file mode 100644 index 000000000..2776e661b --- /dev/null +++ b/node_modules/eslint-plugin-i18n-text/.eslintrc @@ -0,0 +1,18 @@ +{ + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + }, + "plugins": ["prettier"], + "rules": { + "prettier/prettier": "error", + "camelcase": "error", + "eqeqeq": ["error", "smart"], + "no-implicit-globals": "error", + "no-unused-expressions": "error", + "no-var": "error", + "prefer-const": "error", + "strict": "error" + } +} diff --git a/node_modules/eslint-plugin-i18n-text/.prettierrc b/node_modules/eslint-plugin-i18n-text/.prettierrc new file mode 100644 index 000000000..8606dc6cf --- /dev/null +++ b/node_modules/eslint-plugin-i18n-text/.prettierrc @@ -0,0 +1,6 @@ +{ + "bracketSpacing": false, + "semi": false, + "singleQuote": true, + "trailingComma": "none" +} diff --git a/node_modules/eslint-plugin-i18n-text/.travis.yml b/node_modules/eslint-plugin-i18n-text/.travis.yml new file mode 100644 index 000000000..2197832ec --- /dev/null +++ b/node_modules/eslint-plugin-i18n-text/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "node" diff --git a/node_modules/eslint-plugin-i18n-text/LICENSE b/node_modules/eslint-plugin-i18n-text/LICENSE new file mode 100644 index 000000000..02a9b774d --- /dev/null +++ b/node_modules/eslint-plugin-i18n-text/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2017-2019 David Graham + +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. diff --git a/node_modules/eslint-plugin-i18n-text/README.md b/node_modules/eslint-plugin-i18n-text/README.md new file mode 100644 index 000000000..b9b6062cc --- /dev/null +++ b/node_modules/eslint-plugin-i18n-text/README.md @@ -0,0 +1,61 @@ +# eslint-plugin-i18n-text + +Disallow English text in string literals. + +Embedding messages in JavaScript files prevents them from being translated into +other languages. An alternative is to embed the translated text in the markup +and find it with JavaScript. + +```html +
+``` + +```js +const el = document.querySelector('.js-message') +el.textContent = el.getAttribute('data-success-message') +``` + +This pattern allows the web framework that's generating the markup to use +its translation library to insert the appropriate translated text. + +## Installation + +You'll first need to install [ESLint](http://eslint.org): + +``` +$ npm install eslint --save-dev +``` + +Next, install `eslint-plugin-i18n-text`: + +``` +$ npm install eslint-plugin-i18n-text --save-dev +``` + +**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-i18n-text` globally. + +## Usage + +Add `i18n-text` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: + +```json +{ + "plugins": [ + "i18n-text" + ], + "rules": { + "i18n-text/no-en": 2 + } +} +``` + +## Development + +``` +npm install +npm test +``` + +## License + +Distributed under the MIT license. See LICENSE for details. diff --git a/node_modules/eslint-plugin-i18n-text/index.js b/node_modules/eslint-plugin-i18n-text/index.js new file mode 100644 index 000000000..051b16bb8 --- /dev/null +++ b/node_modules/eslint-plugin-i18n-text/index.js @@ -0,0 +1,7 @@ +'use strict' + +module.exports = { + rules: { + 'no-en': require('./rules/no-en') + } +} diff --git a/node_modules/eslint-plugin-i18n-text/package.json b/node_modules/eslint-plugin-i18n-text/package.json new file mode 100644 index 000000000..d1b092c02 --- /dev/null +++ b/node_modules/eslint-plugin-i18n-text/package.json @@ -0,0 +1,27 @@ +{ + "name": "eslint-plugin-i18n-text", + "version": "1.0.1", + "description": "Disallow English text in string literals", + "repository": "dgraham/eslint-plugin-i18n-text", + "license": "MIT", + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin" + ], + "author": "David Graham", + "main": "index.js", + "scripts": { + "pretest": "eslint .", + "test": "mocha --reporter dot tests/" + }, + "peerDependencies": { + "eslint": ">=5.0.0" + }, + "devDependencies": { + "eslint": "^6.4.0", + "eslint-plugin-prettier": "^3.1.0", + "mocha": "^6.2.0", + "prettier": "^1.18.2" + } +} \ No newline at end of file diff --git a/node_modules/eslint-plugin-i18n-text/rules/no-en.js b/node_modules/eslint-plugin-i18n-text/rules/no-en.js new file mode 100644 index 000000000..3593a81d9 --- /dev/null +++ b/node_modules/eslint-plugin-i18n-text/rules/no-en.js @@ -0,0 +1,96 @@ +'use strict' + +const message = 'English text in string literals is not allowed' + +function isEnglish(value) { + return typeof value === 'string' && /^[A-Z][a-z]+\s/.test(value) +} + +function isConsole(node) { + return ( + node.callee.type === 'MemberExpression' && + node.callee.object.name === 'console' + ) +} + +function isInvariant(node) { + return node.callee.type === 'Identifier' && node.callee.name === 'invariant' +} + +function isSuite(node) { + return node.callee.type === 'Identifier' && node.callee.name === 'suite' +} + +function isTest(node) { + return node.callee.type === 'Identifier' && node.callee.name === 'test' +} + +function isAssert(node) { + const direct = + node.callee.type === 'Identifier' && node.callee.name === 'assert' + const member = + node.callee.type === 'MemberExpression' && + node.callee.object.name === 'assert' + return direct || member +} + +module.exports = function(context) { + return { + LogicalExpression: function(node) { + if (node.right.type === 'Literal' && isEnglish(node.right.value)) { + context.report({node: node.right, message}) + } else if (node.right.type === 'TemplateLiteral') { + if (node.right.quasis.some(el => isEnglish(el.value.raw))) { + context.report({node: node.right, message}) + } + } + }, + AssignmentExpression: function(node) { + if (node.right.type === 'Literal' && isEnglish(node.right.value)) { + context.report({node: node.right, message}) + } else if (node.right.type === 'TemplateLiteral') { + if (node.right.quasis.some(el => isEnglish(el.value.raw))) { + context.report({node: node.right, message}) + } + } + }, + CallExpression: function(node) { + if (isConsole(node) || isInvariant(node)) return + if (isSuite(node) || isTest(node) || isAssert(node)) return + + for (const arg of node.arguments) { + if (arg.type === 'Literal' && isEnglish(arg.value)) { + context.report({node: arg, message}) + } else if (arg.type === 'TemplateLiteral') { + if (arg.quasis.some(el => isEnglish(el.value.raw))) { + context.report({node: arg, message}) + } + } + } + }, + ReturnStatement: function(node) { + if (!node.argument) return + + if (node.argument.type === 'Literal' && isEnglish(node.argument.value)) { + context.report({node: node.argument, message}) + } else if (node.argument.type === 'TemplateLiteral') { + if (node.argument.quasis.some(el => isEnglish(el.value.raw))) { + context.report({node: node.argument, message}) + } + } + }, + VariableDeclarator: function(node) { + if (!node.init) return + + if (node.init.type === 'Literal' && isEnglish(node.init.value)) { + context.report({node: node.init, message}) + } else if (node.init.type === 'TemplateLiteral') { + if (node.init.quasis.some(el => isEnglish(el.value.raw))) { + context.report({node: node.init, message}) + } + } + } + } +} + +module.exports.schema = [] diff --git a/node_modules/eslint-plugin-i18n-text/tests/no-en.js b/node_modules/eslint-plugin-i18n-text/tests/no-en.js new file mode 100644 index 000000000..c351de253 --- /dev/null +++ b/node_modules/eslint-plugin-i18n-text/tests/no-en.js @@ -0,0 +1,103 @@ +'use strict' + +const rule = require('../rules/no-en') +const RuleTester = require('eslint').RuleTester + +const error = 'English text in string literals is not allowed' + +const ruleTester = new RuleTester({parserOptions: {ecmaVersion: 6}}) +ruleTester.run('no-en', rule, { + valid: [ + 'invariant(1 == 1, "Assertion message")', + 'invariant(1 == 1, `Assertion message`)', + 'console.debug("Debugging message")', + 'console.debug(`Debugging message`)', + 'console.log("Informational message")', + 'console.warn("Warning message")', + 'console.error("Error message")', + 'throw new Error("Error message")', + 'throw new Error(`Error message`)', + 'var e = new Error("Error message")', + 'var e = new Error(`Error message`)', + 'var x = {"Object key": 42}', + 'var x = {test: "Object value"}', + 'x = 42', + 'x = "42"', + 'x = `42`', + 'var x', + 'var x = 42', + 'var x = "42"', + 'function x() { return }', + 'function x() { return 42 }', + 'function x() { return "42" }', + 'document.addEventListener("click", function(){})', + 'document.addEventListener(`click`, function(){})', + 'suite("Test suite", function(){})', + 'test("Test something", function(){})', + 'assert.equal(1, 2, "Should be false")', + 'assert(false, "Should be true")', + 'assert(false, `Should be true`)' + ], + invalid: [ + { + code: 'el.textContent = "Some message text"', + errors: [{message: error, type: 'Literal'}] + }, + { + code: 'var message = "Some message text"', + errors: [{message: error, type: 'Literal'}] + }, + { + code: 'message = "Some message text"', + errors: [{message: error, type: 'Literal'}] + }, + { + code: 'function x() { return "Some message text" }', + errors: [{message: error, type: 'Literal'}] + }, + { + code: 'displayMessage("Some message text")', + errors: [{message: error, type: 'Literal'}] + }, + { + code: 'list.push("Some message text")', + errors: [{message: error, type: 'Literal'}] + }, + { + code: 'el.textContent = `Some ${x} message text`', + errors: [{message: error, type: 'TemplateLiteral'}] + }, + { + code: 'el.textContent = `Some message text`', + errors: [{message: error, type: 'TemplateLiteral'}] + }, + { + code: 'var message = `Some message text`', + errors: [{message: error, type: 'TemplateLiteral'}] + }, + { + code: 'message = `Some message text`', + errors: [{message: error, type: 'TemplateLiteral'}] + }, + { + code: 'function x() { return `Some message text` }', + errors: [{message: error, type: 'TemplateLiteral'}] + }, + { + code: 'displayMessage(`Some message text`)', + errors: [{message: error, type: 'TemplateLiteral'}] + }, + { + code: 'list.push(`Some message text`)', + errors: [{message: error, type: 'TemplateLiteral'}] + }, + { + code: "someValue || 'Something went wrong'", + errors: [{message: error, type: 'Literal'}] + }, + { + code: 'someValue || `Something went ${adjective} wrong`', + errors: [{message: error, type: 'TemplateLiteral'}] + } + ] +}) diff --git a/node_modules/eslint-plugin-no-only-tests/.github/workflows/nodejs.yml b/node_modules/eslint-plugin-no-only-tests/.github/workflows/nodejs.yml new file mode 100644 index 000000000..5c0f0ddae --- /dev/null +++ b/node_modules/eslint-plugin-no-only-tests/.github/workflows/nodejs.yml @@ -0,0 +1,25 @@ +name: Tests + +on: [push] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 14.x] + + steps: + - uses: actions/checkout@v1 + - uses: borales/actions-yarn@v2.0.0 + with: + cmd: install + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: Tests + run: yarn run test + env: + CI: true diff --git a/node_modules/eslint-plugin-no-only-tests/.github/workflows/npmpublish.yml b/node_modules/eslint-plugin-no-only-tests/.github/workflows/npmpublish.yml new file mode 100644 index 000000000..051a43ec9 --- /dev/null +++ b/node_modules/eslint-plugin-no-only-tests/.github/workflows/npmpublish.yml @@ -0,0 +1,54 @@ +name: Release + +on: + release: + types: [created] + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 12 + - uses: borales/actions-yarn@v2.0.0 + with: + cmd: install + - run: npm test + + publish-npm: + name: Publish NPM + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://registry.npmjs.org/ + - uses: borales/actions-yarn@v2.0.0 + with: + cmd: install + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} + + publish-gpr: + name: Publish GPR + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-node@v1 + with: + node-version: 12 + registry-url: https://npm.pkg.github.com/ + scope: '@levibuzolic' + - uses: borales/actions-yarn@v2.0.0 + with: + cmd: install + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/node_modules/eslint-plugin-no-only-tests/CHANGELOG.md b/node_modules/eslint-plugin-no-only-tests/CHANGELOG.md new file mode 100644 index 000000000..e8d0dc6dd --- /dev/null +++ b/node_modules/eslint-plugin-no-only-tests/CHANGELOG.md @@ -0,0 +1,57 @@ +# v2.6.0 + + * Disable auto fixing by default, allow it to be optionally enabled. + +# v2.5.0 + + * Add support for auto fixing violations - #19 @tgreen7 + +# v2.4.0 + + * Add support for defining 2 levels deep in blocks (ie. `ava.default`) + +# v2.3.1 + + * Bump js-yaml from 3.13.0 to 3.13.1 due to security vulnerability - #11 + +# v2.3.0 + + * Allow test block names to be specified in options - #10 + +# v2.2.0 + + * Added rule for catching `.only` blocks for `serial` - #9 @IevgenRagulin + +# v2.1.0 + + * Added rule for catching `.only` blocks for `fixture` - #8 @roughy + +# v2.0.1 + + * Fixed major bug where rule would cause errors for objects with key `only` - #7 @bendemboski + +# v2.0.0 + + * Updated rule format to ESLint 3 + * Updated ESLInt dependency to `>=3.0.0` + * Updated node engine to `>=4.0.0` + * Get CircleCI up and running + +# v1.2.0 + + * Added rules for catching `.only` blocks for `test`, `context` and `tape` + +# v1.1.0 + + * Updated rule to use `Identifier` rather than `CallExpression` + * Changed reporter to give a more generic message (removed reference to mocha) + * Added additional test coverage + +# v1.0.1 + + * Added additional test coverage + * Removed unnecessary dependencies in `package.json` + +# v1.0.0 + + * Initial version diff --git a/node_modules/eslint-plugin-no-only-tests/LICENSE b/node_modules/eslint-plugin-no-only-tests/LICENSE new file mode 100644 index 000000000..e7e06cc56 --- /dev/null +++ b/node_modules/eslint-plugin-no-only-tests/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Levi Buzolic + +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. diff --git a/node_modules/eslint-plugin-no-only-tests/README.md b/node_modules/eslint-plugin-no-only-tests/README.md new file mode 100644 index 000000000..16075bffd --- /dev/null +++ b/node_modules/eslint-plugin-no-only-tests/README.md @@ -0,0 +1,75 @@ +# eslint-plugin-no-only-tests + +[![Version](https://img.shields.io/npm/v/eslint-plugin-no-only-tests.svg)](https://www.npmjs.com/package/eslint-plugin-no-only-tests) [![Downloads](https://img.shields.io/npm/dm/eslint-plugin-no-only-tests.svg)](https://npmcharts.com/compare/eslint-plugin-no-only-tests?minimal=true) [![GitHub Tests](https://github.com/levibuzolic/eslint-plugin-no-only-tests/workflows/Tests/badge.svg)](https://github.com/levibuzolic/eslint-plugin-no-only-tests/actions?query=workflow%3ATests) + +ESLint rule for `.only` tests in [mocha](https://mochajs.org/) and other JS testing libraries. + +Currently matches the following test blocks by default: `describe`, `it`, `context`, `tape`, `test`, `fixture`, `serial`. + +Designed to prevent you from committing `.only` tests to CI, disabling tests for your whole team. + +As of v2.3 you can now override the test blocks and focus functions. + +## Installation + +First you'll need to install [ESLint](http://eslint.org) then the plugin: + +```bash +npm install --save-dev eslint eslint-plugin-no-only-tests +# or +yarn add --dev eslint eslint-plugin-no-only-tests +``` + +> **Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-no-only-tests` globally. + +## Usage + +Add `no-only-tests` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: + +```json +{ + "plugins": [ + "no-only-tests" + ] +} +``` + +Then configure the rules you want to use under the rules section. + +```json +{ + "rules": { + "no-only-tests/no-only-tests": "error" + } +} +``` + +If you use a testing framework that uses an unsupported block name, or a different way of focusing test (something other than `.only`) you can specify an array of blocks and focus methods to match in the options. + +```json +{ + "rules": { + "no-only-tests/no-only-tests": ["error", {"block": ["test", "it", "assert"], "focus": ["only", "focus"]}] + } +} +``` + +The above example will catch any uses of `test.only`, `test.focus`, `it.only`, `it.focus`, `assert.only` and `assert.focus`. + +This rule supports autofixing only when the `fix` option is set to `true` to avoid changing runtime code unintentionally when configured in an editor. + +```json +{ + "rules": { + "no-only-tests/no-only-tests": ["error", {"fix": true}] + } +} +``` + +## Options + +Option | Type | Description +---|---|--- +`block` | `Array` | Specify the block names that your testing framework uses. Defaults to `["describe", "it", "context", "test", "tape", "fixture", "serial"]` +`focus` | `Array` | Specify the focus scope that your testing framework uses. Defaults to `["only"]` +`fix` | `boolean` | Enable this rule to auto-fix violations, useful for a pre-commit hook, not recommended for users with auto-fixing enabled in their editor. Defaults to `false` diff --git a/node_modules/eslint-plugin-no-only-tests/index.js b/node_modules/eslint-plugin-no-only-tests/index.js new file mode 100644 index 000000000..5928f2e07 --- /dev/null +++ b/node_modules/eslint-plugin-no-only-tests/index.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = { + rules: { + 'no-only-tests': require('./rules/no-only-tests') + } +}; diff --git a/node_modules/eslint-plugin-no-only-tests/package.json b/node_modules/eslint-plugin-no-only-tests/package.json new file mode 100644 index 000000000..5b47c13ad --- /dev/null +++ b/node_modules/eslint-plugin-no-only-tests/package.json @@ -0,0 +1,36 @@ +{ + "name": "eslint-plugin-no-only-tests", + "version": "2.6.0", + "description": "ESLint rule for .only blocks in mocha tests", + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin", + "mocha", + "rule", + "only", + "describe", + "it", + "fixture" + ], + "author": "Levi Buzolic", + "main": "index.js", + "scripts": { + "test": "node tests.js" + }, + "devDependencies": { + "eslint": ">=3.0.0" + }, + "engines": { + "node": ">=4.0.0" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git@github.com:levibuzolic/eslint-plugin-no-only-tests.git" + }, + "bugs": { + "url": "https://github.com/levibuzolic/no-only-tests/issues" + }, + "homepage": "https://github.com/levibuzolic/no-only-tests#readme" +} \ No newline at end of file diff --git a/node_modules/eslint-plugin-no-only-tests/rules/no-only-tests.js b/node_modules/eslint-plugin-no-only-tests/rules/no-only-tests.js new file mode 100644 index 000000000..5fb836b20 --- /dev/null +++ b/node_modules/eslint-plugin-no-only-tests/rules/no-only-tests.js @@ -0,0 +1,88 @@ +/** + * @fileoverview Rule to flag use of .only in tests, preventing focused tests being committed accidentally + * @author Levi Buzolic + */ + +'use strict'; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +const BLOCK_DEFAULTS = ['describe', 'it', 'context', 'test', 'tape', 'fixture', 'serial']; +const FOCUS_DEFAULTS = ['only']; + +module.exports = { + meta: { + docs: { + description: 'disallow .only blocks in tests', + category: 'Possible Errors', + recommended: true, + url: 'https://github.com/levibuzolic/eslint-plugin-no-only-tests', + }, + fixable: true, + schema: [ + { + type: 'object', + properties: { + block: { + type: 'array', + items: { + type: 'string', + }, + uniqueItems: true, + }, + focus: { + type: 'array', + items: { + type: 'string', + }, + uniqueItems: true, + }, + fix: { + type: 'boolean', + }, + }, + additionalProperties: false, + }, + ], + }, + create(context) { + var block = (context.options[0] || {}).block || BLOCK_DEFAULTS; + var focus = (context.options[0] || {}).focus || FOCUS_DEFAULTS; + var fix = !!(context.options[0] || {}).fix; + + return { + Identifier(node) { + var parentObject = node.parent && node.parent.object; + if (parentObject == null) return; + if (focus.indexOf(node.name) === -1) return; + + var callPath = getCallPath(node.parent).join('.'); + + // comparison guarantees that matching is done with the beginning of call path + if (block.find(b => callPath.split(b)[0] === '')) { + context.report({ + node, + message: callPath + ' not permitted', + fix: fix ? fixer => fixer.removeRange([node.range[0] - 1, node.range[1]]) : undefined, + }); + } + }, + }; + }, +}; + +function getCallPath(node, path = []) { + if (node) { + const nodeName = node.name || (node.property && node.property.name); + if (node.object) { + return getCallPath(node.object, [nodeName, ...path]); + } + if (node.callee) { + return getCallPath(node.callee, path); + } + return [nodeName, ...path]; + } + return path; +}