diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 80e5dc9..f9ee33e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,31 +1,44 @@ name: CI on: push: - branches: [main] + branches: + # default semantic-release branches + - +([0-9])?(.{+([0-9]),x}).x + - main + - next + - next-major + - beta + - alpha pull_request: schedule: - cron: 0 0 * * 0 jobs: lint: + name: โฌฃ Lint runs-on: ubuntu-latest steps: - - name: Checkout + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + + - name: โฌ‡๏ธ Checkout repo uses: actions/checkout@v3 - - name: Install Node + - name: โŽ” Setup Node uses: actions/setup-node@v3 with: node-version: 18 - - name: Install Packages + - name: ๐Ÿ“ฅ Install dependencies run: npm install - - name: Lint + - name: โ–ถ๏ธ Run lint script run: npm run lint test: - name: Test (Node@${{ matrix.node }} - ESLint@${{ matrix.eslint }} - ${{ matrix.os }}) + name: + ๐Ÿงช Test (Node@${{ matrix.node }} - ESLint@${{ matrix.eslint }} - ${{ + matrix.os }}) strategy: matrix: eslint: [6] @@ -45,24 +58,65 @@ jobs: os: ubuntu-latest runs-on: ${{ matrix.os }} steps: - - name: Checkout + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + + - name: โฌ‡๏ธ Checkout repo uses: actions/checkout@v3 - - name: Install Node@${{ matrix.node }} + - name: โŽ” Setup Node v${{ matrix.node }} uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} - - name: Install Packages + - name: ๐Ÿ“ฅ Install dependencies run: npm install - # - name: Install ESLint@${{ matrix.eslint }} - # run: npm install eslint@${{ matrix.eslint }} + # - name: ๐Ÿ“ฅ Install ESLint v${{ matrix.eslint }} + # run: npm install --save-dev eslint@${{ matrix.eslint }} - - name: Test + - name: โ–ถ๏ธ Run test script run: npm run test - # - name: Send Coverage - # run: npm run -s codecov - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: โฌ†๏ธ Upload coverage report + uses: codecov/codecov-action@v3 + + release: + name: ๐Ÿš€ Release + needs: [lint, test] + runs-on: ubuntu-latest + if: + github.repository == 'eslint-community/eslint-plugin-mysticatea' && + contains('refs/heads/main,refs/heads/next,refs/heads/beta,refs/heads/alpha', + github.ref) && github.event_name == 'push' + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.11.0 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: ๐Ÿ“ฅ Install dependencies + run: npm install + + - name: ๐Ÿš€ Release + uses: cycjimmy/semantic-release-action@v3 + with: + semantic_version: 19 + branches: | + [ + '+([0-9])?(.{+([0-9]),x}).x', + 'main', + 'next', + 'next-major', + {name: 'beta', prerelease: true}, + {name: 'alpha', prerelease: true} + ] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/lib/rules/arrow-parens.js b/lib/rules/arrow-parens.js index c044776..ddc5100 100644 --- a/lib/rules/arrow-parens.js +++ b/lib/rules/arrow-parens.js @@ -31,7 +31,7 @@ module.exports = { category: "Stylistic Issues", recommended: false, url: - "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/arrow-parens.md", + "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/HEAD/docs/rules/arrow-parens.md", }, fixable: "code", schema: [], diff --git a/lib/rules/block-scoped-var.js b/lib/rules/block-scoped-var.js index 2f1941f..0d719c2 100644 --- a/lib/rules/block-scoped-var.js +++ b/lib/rules/block-scoped-var.js @@ -197,7 +197,7 @@ module.exports = { category: "Possible Errors", recommended: false, url: - "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/block-scoped-var.md", + "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/HEAD/docs/rules/block-scoped-var.md", }, fixable: null, schema: [], diff --git a/lib/rules/no-instanceof-array.js b/lib/rules/no-instanceof-array.js index b1be6ba..5740db0 100644 --- a/lib/rules/no-instanceof-array.js +++ b/lib/rules/no-instanceof-array.js @@ -15,7 +15,7 @@ module.exports = { description: "disallow 'instanceof' for Array", category: "Best Practices", url: - "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-instanceof-array.md", + "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/HEAD/docs/rules/no-instanceof-array.md", }, fixable: "code", schema: [], diff --git a/lib/rules/no-instanceof-wrapper.js b/lib/rules/no-instanceof-wrapper.js index 44904ce..b7ff2dd 100644 --- a/lib/rules/no-instanceof-wrapper.js +++ b/lib/rules/no-instanceof-wrapper.js @@ -15,7 +15,7 @@ module.exports = { description: "disallow 'instanceof' for wrapper objects", category: "Best Practices", url: - "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-instanceof-wrapper.md", + "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/HEAD/docs/rules/no-instanceof-wrapper.md", }, fixable: "code", schema: [], diff --git a/lib/rules/no-literal-call.js b/lib/rules/no-literal-call.js index 259e4dc..a89ec35 100644 --- a/lib/rules/no-literal-call.js +++ b/lib/rules/no-literal-call.js @@ -22,7 +22,7 @@ module.exports = { category: "Possible Errors", recommended: false, url: - "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-literal-call.md", + "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/HEAD/docs/rules/no-literal-call.md", }, fixable: null, schema: [], diff --git a/lib/rules/no-this-in-static.js b/lib/rules/no-this-in-static.js index e58b598..aafa8ac 100644 --- a/lib/rules/no-this-in-static.js +++ b/lib/rules/no-this-in-static.js @@ -15,7 +15,7 @@ module.exports = { description: "Disallow `this`/`super` in static methods", category: "Best Practices", url: - "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-this-in-static.md", + "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/HEAD/docs/rules/no-this-in-static.md", }, fixable: null, schema: [], diff --git a/lib/rules/no-use-ignored-vars.js b/lib/rules/no-use-ignored-vars.js index b8256cc..9c041c8 100644 --- a/lib/rules/no-use-ignored-vars.js +++ b/lib/rules/no-use-ignored-vars.js @@ -21,7 +21,7 @@ module.exports = { category: "Stylistic Issues", recommended: false, url: - "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-use-ignored-vars.md", + "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/HEAD/docs/rules/no-use-ignored-vars.md", }, fixable: null, schema: [{ type: "string" }], diff --git a/lib/rules/no-useless-rest-spread.js b/lib/rules/no-useless-rest-spread.js index afd289a..0d497d4 100644 --- a/lib/rules/no-useless-rest-spread.js +++ b/lib/rules/no-useless-rest-spread.js @@ -98,7 +98,7 @@ module.exports = { category: "Best Practices", recommended: false, url: - "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-useless-rest-spread.md", + "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/HEAD/docs/rules/no-useless-rest-spread.md", }, fixable: "code", schema: [], diff --git a/lib/rules/prefer-for-of.js b/lib/rules/prefer-for-of.js index ff5dbcb..04fa77a 100644 --- a/lib/rules/prefer-for-of.js +++ b/lib/rules/prefer-for-of.js @@ -498,7 +498,7 @@ module.exports = { category: "Best Practices", recommended: false, url: - "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/prefer-for-of.md", + "https://github.com/eslint-community/eslint-plugin-mysticatea/blob/HEAD/docs/rules/prefer-for-of.md", }, fixable: "code", schema: [], diff --git a/lib/utils.js b/lib/utils.js index 8d3d9fb..5bd1b9e 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -38,7 +38,7 @@ module.exports = { return configuredRulesDocumentUrl } try { - const { version, repository } = JSON.parse( + const { repository } = JSON.parse( fs.readFileSync( path.join(process.cwd(), "package.json"), "utf8" @@ -46,7 +46,7 @@ module.exports = { ) const baseUrl = getBaseUrl(repository) if (baseUrl) { - return `${baseUrl}/blob/v${version}/docs/rules/{{name}}.md` + return `${baseUrl}/blob/HEAD/docs/rules/{{name}}.md` } } catch (_error) { // ignore diff --git a/package.json b/package.json index 29a6530..495ae34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eslint-community/eslint-plugin-mysticatea", - "version": "13.0.0", + "version": "0.0.0-semantically-released", "description": "Additional ESLint rules.", "engines": { "node": ">=8.10.0" @@ -25,7 +25,6 @@ }, "devDependencies": { "@eslint-community/eslint-plugin-mysticatea": "file:.", - "codecov": "^3.6.1", "eslint": "~6.6.0", "fs-extra": "^8.1.0", "globals": "^12.1.1", @@ -39,7 +38,6 @@ "scripts": { "clean": "rimraf .nyc_output coverage", "coverage": "opener coverage/lcov-report/index.html", - "codecov": "codecov --disable=gcov -t $CODECOV_TOKEN", "lint": "eslint lib scripts tests", "test": "nyc mocha \"tests/lib/**/*.js\" --reporter dot", "update": "node scripts/generate-browser-globals && node scripts/generate-configs && node scripts/generate-rules",