Skip to content

Commit

Permalink
fix: don't add rules if they're not available
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Nov 14, 2022
1 parent 9225766 commit 97bb2e2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ on:

jobs:
lint:
name: ⬣ Lint
name: ⬣ Lint (ESLint@${{ matrix.eslint }})
strategy:
matrix:
eslint: [6, 7]
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
Expand All @@ -32,6 +35,9 @@ jobs:
- name: 📥 Install dependencies
run: npm install

- name: 📥 Install ESLint v${{ matrix.eslint }}
run: npm install --save-dev eslint@${{ matrix.eslint }}

- name: ▶️ Run lint script
run: npm run lint

Expand Down
19 changes: 12 additions & 7 deletions lib/configs/_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
*/
"use strict"

const { ESLint } = require("eslint")

const isESLint7 = ESLint.version.startsWith("7.")

/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
plugins: ["@eslint-community/mysticatea"],
Expand All @@ -27,7 +32,7 @@ module.exports = {
"consistent-return": "error",
curly: "error",
"default-case": "error",
"default-case-last": "error",
"default-case-last": isESLint7 ? "error" : "off", // TODO: enable once we drop ESLint v6 support
"default-param-last": "error",
"dot-notation": "error",
eqeqeq: ["error", "always", { null: "ignore" }],
Expand Down Expand Up @@ -93,7 +98,7 @@ module.exports = {
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-loss-of-precision": "error",
"no-loss-of-precision": isESLint7 ? "error" : "off", // TODO: enable once we drop ESLint v6 support
"no-misleading-character-class": "error",
"no-mixed-operators": [
"error",
Expand All @@ -108,14 +113,14 @@ module.exports = {
"no-new-object": "error",
"no-new-require": "error",
"no-new-wrappers": "error",
"no-nonoctal-decimal-escape": "error",
"no-nonoctal-decimal-escape": isESLint7 ? "error" : "off", // TODO: enable once we drop ESLint v6 support
"no-obj-calls": "error",
"no-octal": "error",
"no-octal-escape": "error",
"no-param-reassign": ["error", { props: false }],
"no-process-env": "error",
"no-process-exit": "error",
"no-promise-executor-return": "error",
"no-promise-executor-return": isESLint7 ? "error" : "off", // TODO: enable once we drop ESLint v6 support
"no-prototype-builtins": "error",
"no-redeclare": ["error", { builtinGlobals: true }],
"no-regex-spaces": "error",
Expand Down Expand Up @@ -146,10 +151,10 @@ module.exports = {
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "error",
"no-unreachable": "error",
"no-unreachable-loop": "error",
"no-unreachable-loop": isESLint7 ? "error" : "off", // TODO: enable once we drop ESLint v6 support
"no-unsafe-finally": "error",
"no-unsafe-negation": ["error", { enforceForOrderingRelations: true }],
"no-unsafe-optional-chaining": "error",
"no-unsafe-optional-chaining": isESLint7 ? "error" : "off", // TODO: enable once we drop ESLint v6 support
"no-unused-expressions": "error",
"no-unused-labels": "error",
"no-unused-vars": [
Expand All @@ -163,7 +168,7 @@ module.exports = {
},
],
"no-use-before-define": ["error", "nofunc"],
"no-useless-backreference": "error",
"no-useless-backreference": isESLint7 ? "error" : "off", // TODO: enable once we drop ESLint v6 support
"no-useless-call": "error",
"no-useless-catch": "error",
"no-useless-concat": "error",
Expand Down

0 comments on commit 97bb2e2

Please sign in to comment.