From d3a3444558f9783f72abbbce207b3ff634a89323 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Mon, 4 Oct 2021 16:58:22 +0300 Subject: [PATCH 1/2] Move eslint to npm scripts --- package.json | 8 ++++++-- test/lint.js | 46 ---------------------------------------------- 2 files changed, 6 insertions(+), 48 deletions(-) delete mode 100644 test/lint.js diff --git a/package.json b/package.json index b01cc2cc..beaf09ff 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,14 @@ "node": ">=12" }, "scripts": { - "test": "mocha test" + "lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .", + "fix": "npm run eslint -- --fix", + "mocha": "mocha", + "test": "npm run lint && mocha" }, "repository": { "type": "git", - "url": "git://github.com/dlmanning/gulp-sass" + "url": "git+https://github.com/dlmanning/gulp-sass.git" }, "keywords": [ "gulpplugin", @@ -23,6 +26,7 @@ "bugs": { "url": "https://github.com/dlmanning/gulp-sass/issues" }, + "homepage": "https://github.com/dlmanning/gulp-sass#readme", "files": [ "index.js" ], diff --git a/test/lint.js b/test/lint.js deleted file mode 100644 index 071b8fc4..00000000 --- a/test/lint.js +++ /dev/null @@ -1,46 +0,0 @@ -const eslint = require('eslint'); -const should = require('should'); - -describe('code style guide', () => { - it('index.js should follow our lint style guide', (done) => { - const cli = new eslint.CLIEngine({ rules: { 'spaced-comment': 0 } }); - const formatter = cli.getFormatter(); - const report = cli.executeOnFiles(['index.js']); - - if (report.errorCount > 0 || report.warningCount > 0) { - console.log(formatter(report.results)); - } - - should(report.errorCount).equal(0); - should(report.warningCount).equal(0); - done(); - }); - - it('test/main.js should follow our lint style guide', (done) => { - const cli = new eslint.CLIEngine(); - const formatter = cli.getFormatter(); - const report = cli.executeOnFiles(['test/main.js']); - - if (report.errorCount > 0 || report.warningCount > 0) { - console.log(formatter(report.results)); - } - - should(report.errorCount).equal(0); - should(report.warningCount).equal(0); - done(); - }); - - it('test/lint.js should follow our lint style guide', (done) => { - const cli = new eslint.CLIEngine({ rules: { 'no-console': 0 } }); - const formatter = cli.getFormatter(); - const report = cli.executeOnFiles(['test/lint.js']); - - if (report.errorCount > 0 || report.warningCount > 0) { - console.log(formatter(report.results)); - } - - should(report.errorCount).equal(0); - should(report.warningCount).equal(0); - done(); - }); -}); From 7ddfabfee7dd3b7baa57655a18e95535c90afa93 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 6 Oct 2021 10:06:16 +0300 Subject: [PATCH 2/2] CI: run lint once --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ package.json | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58f00577..ca3c4465 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,8 +8,29 @@ on: env: FORCE_COLOR: 2 + NODE_LINT: 14 # The Node.js version to run lint jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - name: Clone repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_LINT }} + cache: npm + + - name: Install npm dependencies + run: npm ci + + - name: Lint + run: npm run lint + test: name: Node ${{ matrix.node }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} diff --git a/package.json b/package.json index beaf09ff..e81c1ec0 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .", "fix": "npm run eslint -- --fix", "mocha": "mocha", - "test": "npm run lint && mocha" + "test": "mocha" }, "repository": { "type": "git",