From 2a1e0b69a2a5b3b5476b828b9e9ff3cb25e43ed4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Sun, 10 Oct 2021 17:03:04 +0200 Subject: [PATCH 1/3] feat: support ESLint 8.x --- .github/workflows/validate.yml | 39 ++++++++++++++++++++++++++++++++++ .gitignore | 8 ++++++- .npmrc | 1 + .travis.yml | 3 --- package.json | 16 ++++++++------ test/validate-config.js | 20 +++++++---------- 6 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/validate.yml create mode 100644 .npmrc delete mode 100644 .travis.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..a700450 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,39 @@ +name: validate + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + main: + strategy: + matrix: + eslint: [7.12.1, 7, 8.0.0, 8] + node: [12.22.0, 12, 14.17.0, 14, 16.0.0, 16] + runs-on: ubuntu-latest + steps: + - name: 🛑 Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: ⬇️ Checkout repo + uses: actions/checkout@v2 + + - name: ⎔ Setup node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: Install ESLint v${{ matrix.eslint }} + run: npm install --no-save --force eslint@${{ matrix.eslint }} + + - name: ▶️ Run tests + run: npm test diff --git a/.gitignore b/.gitignore index c2658d7..8d8d31c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ -node_modules/ +node_modules +.DS_Store + +# these cause more harm than good +# when working with contributors +package-lock.json +yarn.lock diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c159f6a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - lts/* diff --git a/package.json b/package.json index affa577..3e4fb36 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,6 @@ "bugs": { "url": "https://github.com/standard/eslint-config-standard-jsx/issues" }, - "devDependencies": { - "eslint": "^7.12.1", - "eslint-plugin-react": "^7.21.5", - "tape": "^5.0.1" - }, "homepage": "https://github.com/standard/eslint-config-standard-jsx", "keywords": [ "JavaScript Standard Style", @@ -45,8 +40,14 @@ ], "license": "MIT", "main": "index.js", + "dependencies": {}, + "devDependencies": { + "eslint": "^8.7.0", + "eslint-plugin-react": "^7.28.0", + "tape": "^5.0.1" + }, "peerDependencies": { - "eslint": "^7.12.1", + "eslint": "^7.12.1 || ^8.0.0", "eslint-plugin-react": "^7.21.5" }, "repository": { @@ -56,6 +57,9 @@ "scripts": { "test": "tape test/*.js" }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, "funding": [ { "type": "github", diff --git a/test/validate-config.js b/test/validate-config.js index 5e7393a..deebf67 100644 --- a/test/validate-config.js +++ b/test/validate-config.js @@ -1,26 +1,22 @@ -const eslint = require('eslint') +const { ESLint } = require('eslint') const test = require('tape') test('load config in eslint to validate all rule syntax is correct', function (t) { - const CLIEngine = eslint.CLIEngine - - const cli = new CLIEngine({ + const cli = new ESLint({ useEslintrc: false, - configFile: 'eslintrc.json' + overrideConfigFile: 'eslintrc.json' }) const code = 'var foo = 1\nvar bar = function () {}\nbar(foo)\n' - t.equal(cli.executeOnText(code).errorCount, 0) + t.equal(cli.lintText(code).errorCount, 0) t.end() }) test('space before an opening tag\'s closing bracket should not be allowed', t => { - const CLIEngine = eslint.CLIEngine - - const cli = new CLIEngine({ + const cli = new ESLint({ useEslintrc: false, - configFile: 'eslintrc.json' + overrideConfigFile: 'eslintrc.json' }) const shouldPass = { @@ -59,12 +55,12 @@ test('space before an opening tag\'s closing bracket should not be allowed', t = t.plan(testPlansCount) for (const testCase in shouldPass) { - const { errorCount } = cli.executeOnText(shouldPass[testCase]) + const { errorCount } = cli.lintText(shouldPass[testCase]) t.equal(errorCount, 0) } for (const testCase in shouldFail) { - const { errorCount } = cli.executeOnText(shouldFail[testCase]) + const { errorCount } = cli.lintText(shouldFail[testCase]) t.true(errorCount > 0) } }) From 98c58c1073cf4092b11b87a3634aff773a3aa8f8 Mon Sep 17 00:00:00 2001 From: Pelle Wessman Date: Mon, 31 Jan 2022 20:04:54 +0100 Subject: [PATCH 2/3] Sync with `eslint-config-standard` --- .gitignore | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.gitignore b/.gitignore index 8d8d31c..3c3629e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1 @@ node_modules -.DS_Store - -# these cause more harm than good -# when working with contributors -package-lock.json -yarn.lock From a6e10e4293dde86ab5fe102ace7dd32fe9ae764a Mon Sep 17 00:00:00 2001 From: Pelle Wessman Date: Mon, 31 Jan 2022 20:07:55 +0100 Subject: [PATCH 3/3] Sync with `eslint-config-standard` --- package.json | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 3e4fb36..0561065 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,11 @@ "bugs": { "url": "https://github.com/standard/eslint-config-standard-jsx/issues" }, + "devDependencies": { + "eslint": "^8.8.0", + "eslint-plugin-react": "^7.28.0", + "tape": "^5.5.0" + }, "homepage": "https://github.com/standard/eslint-config-standard-jsx", "keywords": [ "JavaScript Standard Style", @@ -40,15 +45,9 @@ ], "license": "MIT", "main": "index.js", - "dependencies": {}, - "devDependencies": { - "eslint": "^8.7.0", - "eslint-plugin-react": "^7.28.0", - "tape": "^5.0.1" - }, "peerDependencies": { - "eslint": "^7.12.1 || ^8.0.0", - "eslint-plugin-react": "^7.21.5" + "eslint": "^8.8.0", + "eslint-plugin-react": "^7.28.0" }, "repository": { "type": "git", @@ -57,9 +56,6 @@ "scripts": { "test": "tape test/*.js" }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - }, "funding": [ { "type": "github",