Skip to content

Commit

Permalink
feat: support ESLint 7.x
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Requires Node@^10.12.0 || >=12.0.0
BREAKING CHANGE: Requires ESLint@^7.0.0
  • Loading branch information
MichaelDeBoey committed Oct 10, 2021
1 parent 21838c6 commit f9c4c6b
Show file tree
Hide file tree
Showing 32 changed files with 310 additions and 113 deletions.
15 changes: 15 additions & 0 deletions .eslintrc.yml
Expand Up @@ -2,3 +2,18 @@ root: true
extends:
- plugin:@mysticatea/es2015
- plugin:@mysticatea/+eslint-plugin

overrides:
- files: ["lib/utils.js", "scripts/*.js"]
rules:
"@mysticatea/node/no-sync": off

- files:
[
"lib/configs.js",
"lib/foreign-rules/ts.js",
"lib/processors.js",
"lib/rules.js",
]
rules:
"@mysticatea/node/global-require": off
29 changes: 23 additions & 6 deletions .github/workflows/CI.yml
Expand Up @@ -10,17 +10,34 @@ on:
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node: [12.x, 10.x, 8.x]
os: [ubuntu-latest]
eslint: [7]
node: [16]
include:
# On other platforms
- node: 16
os: windows-latest
- node: 16
os: macos-latest
# On old Node.js versions
- node: 14
os: ubuntu-latest
- node: 12
os: ubuntu-latest
- node: 10
os: ubuntu-latest
# On the minimum supported ESLint/Node.js version
- node: 10.12.0
os: ubuntu-latest

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1
uses: actions/checkout@v2
- name: Install Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Install Packages
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -16,8 +16,8 @@ npm install --save-dev eslint @mysticatea/eslint-plugin

### Requirements

- Node.js `^8.10.0` or newer versions.
- ESLint `^6.3.0` or newer versions.
- Node.js `^10.12.0 || >=12.0.0` or newer versions.
- ESLint `^7.0.0` or newer versions.

## 📖 Usage

Expand Down
4 changes: 4 additions & 0 deletions lib/configs/+eslint-plugin.js
Expand Up @@ -34,18 +34,22 @@ module.exports = {
"@mysticatea/eslint-plugin/no-missing-placeholders": "error",
"@mysticatea/eslint-plugin/no-unused-placeholders": "error",
"@mysticatea/eslint-plugin/no-useless-token-range": "error",
"@mysticatea/eslint-plugin/prefer-object-rule": "error",
"@mysticatea/eslint-plugin/prefer-output-null": "error",
"@mysticatea/eslint-plugin/prefer-placeholders": "error",
"@mysticatea/eslint-plugin/prefer-replace-text": "error",
"@mysticatea/eslint-plugin/report-message-format": [
"error",
"[^a-z'\"{].*\\.$",
],
"@mysticatea/eslint-plugin/require-meta-docs-description":
"error",
"@mysticatea/eslint-plugin/require-meta-docs-url": [
"error",
{ pattern: rulesDocumentUrl },
],
"@mysticatea/eslint-plugin/require-meta-fixable": "error",
"@mysticatea/eslint-plugin/require-meta-schema": "error",
"@mysticatea/eslint-plugin/require-meta-type": "error",
"@mysticatea/eslint-plugin/test-case-property-ordering": [
"error",
Expand Down
11 changes: 11 additions & 0 deletions lib/configs/+node.js
Expand Up @@ -46,19 +46,30 @@ module.exports = {
require: "readonly",
},
rules: {
"@mysticatea/node/callback-return": "error",
"@mysticatea/node/exports-style": ["error", "module.exports"],
"@mysticatea/node/file-extension-in-import": [
"error",
"always",
{ ".js": "never", ".ts": "never", ".tsx": "never" },
],
"@mysticatea/node/global-require": "error",
"@mysticatea/node/handle-callback-err": "error",
"@mysticatea/node/no-callback-literal": "off",
"@mysticatea/node/no-deprecated-api": "error",
"@mysticatea/node/no-exports-assign": "error",
"@mysticatea/node/no-extraneous-import": "error",
"@mysticatea/node/no-extraneous-require": "error",
"@mysticatea/node/no-missing-import": "error",
"@mysticatea/node/no-missing-require": "error",
"@mysticatea/node/no-mixed-requires": "error",
"@mysticatea/node/no-new-require": "error",
"@mysticatea/node/no-path-concat": "error",
"@mysticatea/node/no-process-env": "error",
"@mysticatea/node/no-process-exit": "error",
"@mysticatea/node/no-restricted-import": "error",
"@mysticatea/node/no-restricted-require": "error",
"@mysticatea/node/no-sync": "error",
"@mysticatea/node/no-unpublished-bin": "error",
"@mysticatea/node/no-unpublished-import": "error",
"@mysticatea/node/no-unpublished-require": "error",
Expand Down
15 changes: 15 additions & 0 deletions lib/configs/_base.js
Expand Up @@ -27,12 +27,14 @@ module.exports = {
"consistent-return": "error",
curly: "error",
"default-case": "error",
"default-case-last": "error",
"default-param-last": "error",
"dot-notation": "error",
eqeqeq: ["error", "always", { null: "ignore" }],
"for-direction": "error",
"func-style": ["error", "declaration"],
"getter-return": "error",
"grouped-accessor-pairs": "error",
"init-declarations": "error",
"linebreak-style": ["error", "unix"],
"lines-between-class-members": "error",
Expand All @@ -47,11 +49,13 @@ module.exports = {
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-constant-condition": "error",
"no-constructor-return": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-div-regex": "error",
"no-dupe-args": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-else-return": "error",
Expand Down Expand Up @@ -89,6 +93,7 @@ module.exports = {
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-mixed-operators": [
"error",
Expand All @@ -103,10 +108,12 @@ module.exports = {
"no-new-object": "error",
"no-new-require": "error",
"no-new-wrappers": "error",
"no-nonoctal-decimal-escape": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-octal-escape": "error",
"no-param-reassign": ["error", { props: false }],
"no-promise-executor-return": "error",
"no-process-env": "error",
"no-process-exit": "error",
"no-prototype-builtins": "error",
Expand All @@ -128,6 +135,7 @@ module.exports = {
"no-self-assign": ["error", { props: true }],
"no-self-compare": "error",
"no-sequences": "error",
"no-setter-return": "error",
"no-shadow": ["error", { builtinGlobals: true }],
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
Expand All @@ -138,8 +146,10 @@ module.exports = {
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "error",
"no-unreachable": "error",
"no-unreachable-loop": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": ["error", { enforceForOrderingRelations: true }],
"no-unsafe-optional-chaining": "error",
"no-unused-expressions": "error",
"no-unused-labels": "error",
"no-unused-vars": [
Expand All @@ -153,6 +163,7 @@ module.exports = {
},
],
"no-use-before-define": ["error", "nofunc"],
"no-useless-backreference": "error",
"no-useless-call": "error",
"no-useless-catch": "error",
"no-useless-concat": "error",
Expand All @@ -173,6 +184,7 @@ module.exports = {
{ blankLine: "always", next: "function", prev: "*" },
{ blankLine: "always", next: "*", prev: "function" },
],
"prefer-exponentiation-operator": "error",
"prefer-promise-reject-errors": "error",
"prefer-regex-literals": "error",
quotes: ["error", "double", { avoidEscape: true }],
Expand Down Expand Up @@ -294,6 +306,7 @@ module.exports = {
"guard-for-in": "off",
"handle-callback-err": "off",
"id-blacklist": "off",
"id-denylist": "off",
"id-length": "off",
"id-match": "off",
"line-comment-position": "off",
Expand Down Expand Up @@ -327,6 +340,7 @@ module.exports = {
"no-path-concat": "off",
"no-plusplus": "off",
"no-proto": "off",
"no-restricted-exports": "off",
"no-restricted-globals": "off",
"no-restricted-imports": "off",
"no-restricted-modules": "off",
Expand Down Expand Up @@ -387,6 +401,7 @@ module.exports = {
],
},
],
"@mysticatea/eslint-comments/require-description": "error",

// prettier
"@mysticatea/prettier": [
Expand Down
2 changes: 2 additions & 0 deletions lib/configs/_browser-globals.js
@@ -1,4 +1,6 @@
//
// DON'T EDIT THIS FILE WHICH WAS GENERATED BY './scripts/generate-browser-globals.js'.
//
"use strict"

module.exports = {
Expand Down
2 changes: 0 additions & 2 deletions lib/configs/_override-special.js
Expand Up @@ -18,7 +18,6 @@ module.exports = {
extends: [require.resolve("./+node.js")],
rules: {
"no-console": "off",
"no-process-env": "off",
},
},
{
Expand All @@ -33,7 +32,6 @@ module.exports = {
],
rules: {
"no-console": "off",
"no-process-env": "off",
},
},
],
Expand Down
54 changes: 46 additions & 8 deletions lib/configs/_override-ts.js
Expand Up @@ -19,40 +19,79 @@ module.exports = {
"@mysticatea/ts/adjacent-overload-signatures": "error",
"@mysticatea/ts/array-type": "error",
"@mysticatea/ts/await-thenable": "error",
"@mysticatea/ts/ban-ts-ignore": "error",
"@mysticatea/ts/class-name-casing": "error",
"@mysticatea/ts/ban-ts-comment": "error",
"@mysticatea/ts/ban-tslint-comment": "error",
"@mysticatea/ts/class-literal-property-style": "error",
"@mysticatea/ts/comma-spacing": "error",
"@mysticatea/ts/no-confusing-non-null-assertion": "error",
"@mysticatea/ts/consistent-type-assertions": "error",
"@mysticatea/ts/default-param-last": "error",
"@mysticatea/ts/dot-notation": "error",
"@mysticatea/ts/explicit-member-accessibility": "error",
"@mysticatea/ts/interface-name-prefix": "error",
"@mysticatea/ts/member-naming": "error",
"@mysticatea/ts/explicit-module-boundary-types": "error",
"@mysticatea/ts/init-declarations": "error",
"@mysticatea/ts/keyword-spacing": "error",
"@mysticatea/ts/method-signature-style": "error",
"@mysticatea/ts/naming-convention": "error",
"@mysticatea/ts/no-array-constructor": "error",
"@mysticatea/ts/no-base-to-string": "error",
"@mysticatea/ts/no-dupe-class-members": "error",
"@mysticatea/ts/no-dynamic-delete": "error",
"@mysticatea/ts/no-empty-interface": "error",
"@mysticatea/ts/no-implicit-any-catch": "error",
"@mysticatea/ts/no-extra-non-null-assertion": "error",
"@mysticatea/ts/no-extra-semi": "error",
"@mysticatea/ts/no-extraneous-class": "error",
"@mysticatea/ts/no-floating-promises": "error",
"@mysticatea/ts/no-for-in-array": "error",
"@mysticatea/ts/no-implied-eval": "error",
"@mysticatea/ts/no-inferrable-types": "error",
"@mysticatea/ts/no-invalid-this": "error",
"@mysticatea/ts/no-invalid-void-type": "error",
"@mysticatea/ts/no-misused-new": "error",
"@mysticatea/ts/no-misused-promises": "error",
"@mysticatea/ts/no-non-null-asserted-optional-chain": "error",
"@mysticatea/ts/no-parameter-properties": "error",
"@mysticatea/ts/no-require-imports": "error",
"@mysticatea/ts/no-this-alias": [
"error",
{ allowDestructuring: true },
],
"@mysticatea/ts/no-throw-literal": "error",
"@mysticatea/ts/no-unnecessary-boolean-literal-compare":
"error",
"@mysticatea/ts/no-unnecessary-qualifier": "error",
"@mysticatea/ts/no-unnecessary-type-arguments": "error",
"@mysticatea/ts/no-unnecessary-type-assertion": "error",
"@mysticatea/ts/no-unsafe-assignment": "error",
"@mysticatea/ts/no-unsafe-call": "error",
"@mysticatea/ts/no-unsafe-member-access": "error",
"@mysticatea/ts/no-unsafe-return": "error",
"@mysticatea/ts/no-unused-expressions": "error",
"@mysticatea/ts/no-unused-vars-experimental": "error",
"@mysticatea/ts/no-var-requires": "error",
"@mysticatea/ts/prefer-as-const": "error",
"@mysticatea/ts/prefer-enum-initializers": "error",
// https://github.com/typescript-eslint/typescript-eslint/issues/454
"@mysticatea/ts/prefer-function-type": "off",
"@mysticatea/ts/prefer-includes": "error",
"@mysticatea/ts/prefer-literal-enum-member": "error",
"@mysticatea/ts/prefer-namespace-keyword": "error",
"@mysticatea/ts/prefer-nullish-coalescing": "error",
"@mysticatea/ts/prefer-optional-chain": "error",
"@mysticatea/ts/prefer-readonly-parameter-types": "error",
// https://github.com/typescript-eslint/typescript-eslint/issues/946
"@mysticatea/ts/prefer-readonly": "off",
"@mysticatea/ts/prefer-reduce-type-parameter": "off",
"@mysticatea/ts/prefer-regexp-exec": "error",
"@mysticatea/ts/prefer-string-starts-ends-with": "error",
"@mysticatea/ts/prefer-ts-expect-error": "off",
"@mysticatea/ts/require-array-sort-compare": "off",
"@mysticatea/ts/restrict-plus-operands": "error",
"@mysticatea/ts/require-array-sort-compare": "error",
"@mysticatea/ts/restrict-template-expressions": "error",
"@mysticatea/ts/return-await": "error",
"@mysticatea/ts/space-before-function-paren": "error",
"@mysticatea/ts/switch-exhaustiveness-check": "error",
"@mysticatea/ts/triple-slash-reference": "error",
// なんか誤検知が多い...
"@mysticatea/ts/unbound-method": [
Expand All @@ -61,6 +100,8 @@ module.exports = {
],
// https://github.com/typescript-eslint/typescript-eslint/issues/452
"@mysticatea/ts/unified-signatures": "off",
"@mysticatea/ts/lines-between-class-members": "error",
"@mysticatea/ts/no-loss-of-precision": "error",
"@mysticatea/prettier": [
"error",
{
Expand All @@ -75,8 +116,6 @@ module.exports = {
],

// Replacements
camelcase: "off",
"@mysticatea/ts/camelcase": "error",
"no-empty-function": "off",
"@mysticatea/ts/no-empty-function": "error",
"no-useless-constructor": "off",
Expand All @@ -101,7 +140,6 @@ module.exports = {
"@mysticatea/ts/consistent-type-definitions": "off",
"@mysticatea/ts/explicit-function-return-type": "off", // I want but this is not so...
"@mysticatea/ts/func-call-spacing": "off", // favor of Prettier.
"@mysticatea/ts/generic-type-naming": "off",
"@mysticatea/ts/indent": "off", // favor of Prettier.
"@mysticatea/ts/member-delimiter-style": "off", // favor of Prettier.
"@mysticatea/ts/member-ordering": "off",
Expand Down

0 comments on commit f9c4c6b

Please sign in to comment.