Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: support ESLint v8 #3737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Aug 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"bigint",
"bivariant",
"blockless",
"camelcase",
"codebases",
"Codecov",
"contravariant",
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ module.exports = {
'@typescript-eslint/internal/prefer-ast-types-enum': 'error',

//
// eslint base
// eslint-base
//

curly: ['error', 'all'],
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ jobs:
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn check-clean-workspace-after-install

- name: Patch Dependencies
run: |
yarn patch-package

- name: Build
run: |
yarn build
Expand Down Expand Up @@ -87,6 +91,10 @@ jobs:
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn check-clean-workspace-after-install

- name: Patch Dependencies
run: |
yarn patch-package

- name: Build
run: |
yarn build
Expand Down Expand Up @@ -165,6 +173,10 @@ jobs:
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn check-clean-workspace-after-install

- name: Patch Dependencies
run: |
yarn patch-package

- name: Build
run: |
yarn build
Expand Down Expand Up @@ -208,6 +220,10 @@ jobs:
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn check-clean-workspace-after-install

- name: Patch Dependencies
run: |
yarn patch-package

- name: Build
run: |
yarn build
Expand Down Expand Up @@ -247,6 +263,10 @@ jobs:
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn check-clean-workspace-after-install

- name: Patch Dependencies
run: |
yarn patch-package

- name: Build
run: |
yarn build
Expand Down Expand Up @@ -322,6 +342,10 @@ jobs:
yarn --ignore-engines --frozen-lockfile --ignore-scripts
yarn check-clean-workspace-after-install

- name: Patch Dependencies
run: |
yarn patch-package

- name: Build
run: |
yarn build
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"lint-markdown-fix": "yarn lint-markdown --fix",
"lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore",
"lint": "eslint . --ext .js,.ts",
"postinstall": "yarn husky install && yarn build",
"postinstall": "patch-package && yarn husky install && yarn build",
"pre-commit": "yarn lint-staged",
"pre-push": "yarn check-format",
"test": "nx run-many --target=test --all --parallel",
Expand Down Expand Up @@ -100,7 +100,8 @@
"cspell": "^5.5.2",
"cz-conventional-changelog": "^3.3.0",
"downlevel-dts": "^0.7.0",
"eslint": "^7.27.0",
"enhanced-resolve": "^5.8.2",
"eslint": "^8.0.0-0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-eslint-plugin": "^3.0.3",
"eslint-plugin-import": "^2.23.4",
Expand All @@ -115,6 +116,7 @@
"make-dir": "^3.1.0",
"markdownlint-cli": "^0.28.1",
"node-fetch": "^2.6.1",
"patch-package": "^6.4.7",
"prettier": "2.3.2",
"pretty-format": "^27.0.2",
"rimraf": "^3.0.2",
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin-internal/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// @ts-check
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
resolver: '<rootDir>/../../tests/jest-resolver.js',
globals: {
'ts-jest': {
isolatedModules: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default createRule({
requiresTypeChecking: true,
},
fixable: 'code',
hasSuggestions: true,
schema: [],
messages: {
doNotUse: 'Do not use {{type}}.{{property}} because it is poorly typed.',
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin-tslint/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// @ts-check
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
resolver: '<rootDir>/../../tests/jest-resolver.js',
globals: {
'ts-jest': {
isolatedModules: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-tslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"lodash": "^4.17.21"
},
"peerDependencies": {
"eslint": "^5.0.0 || ^6.0.0 || ^7.0.0",
"eslint": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0",
"tslint": "^5.0.0 || ^6.0.0",
"typescript": "*"
},
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// @ts-check
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
resolver: '<rootDir>/../../tests/jest-resolver.js',
globals: {
'ts-jest': {
isolatedModules: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
},
"peerDependencies": {
"@typescript-eslint/parser": "^4.0.0",
"eslint": "^5.0.0 || ^6.0.0 || ^7.0.0"
"eslint": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0"
},
"peerDependenciesMeta": {
"typescript": {
Expand Down
5 changes: 4 additions & 1 deletion packages/eslint-plugin/src/rules/brace-style.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { TSESTree } from '@typescript-eslint/experimental-utils';
import baseRule from 'eslint/lib/rules/brace-style';
import { getESLintCoreRule } from '../util/getESLintCoreRule';
import {
InferOptionsTypeFromRule,
InferMessageIdsTypeFromRule,
createRule,
isTokenOnSameLine,
} from '../util';

const baseRule = getESLintCoreRule('brace-style');

export type Options = InferOptionsTypeFromRule<typeof baseRule>;
export type MessageIds = InferMessageIdsTypeFromRule<typeof baseRule>;

Expand All @@ -22,6 +24,7 @@ export default createRule<Options, MessageIds>({
},
messages: baseRule.meta.messages,
fixable: baseRule.meta.fixable,
hasSuggestions: baseRule.meta.hasSuggestions,
schema: baseRule.meta.schema,
},
defaultOptions: ['1tbs'],
Expand Down
5 changes: 4 additions & 1 deletion packages/eslint-plugin/src/rules/comma-dangle.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import * as util from '../util';
import baseRule from 'eslint/lib/rules/comma-dangle';
import { getESLintCoreRule } from '../util/getESLintCoreRule';
import {
TSESTree,
AST_NODE_TYPES,
} from '@typescript-eslint/experimental-utils';

const baseRule = getESLintCoreRule('comma-dangle');

export type Options = util.InferOptionsTypeFromRule<typeof baseRule>;
export type MessageIds = util.InferMessageIdsTypeFromRule<typeof baseRule>;

Expand Down Expand Up @@ -83,6 +85,7 @@ export default util.createRule<Options, MessageIds>({
additionalProperties: false,
},
fixable: 'code',
hasSuggestions: baseRule.meta.hasSuggestions,
messages: baseRule.meta.messages,
},
defaultOptions: ['never'],
Expand Down
5 changes: 4 additions & 1 deletion packages/eslint-plugin/src/rules/dot-notation.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { TSESTree } from '@typescript-eslint/experimental-utils';
import * as ts from 'typescript';
import * as tsutils from 'tsutils';
import baseRule from 'eslint/lib/rules/dot-notation';
import { getESLintCoreRule } from '../util/getESLintCoreRule';
import {
createRule,
getParserServices,
InferMessageIdsTypeFromRule,
InferOptionsTypeFromRule,
} from '../util';

const baseRule = getESLintCoreRule('dot-notation');

export type Options = InferOptionsTypeFromRule<typeof baseRule>;
export type MessageIds = InferMessageIdsTypeFromRule<typeof baseRule>;

Expand Down Expand Up @@ -52,6 +54,7 @@ export default createRule<Options, MessageIds>({
},
],
fixable: baseRule.meta.fixable,
hasSuggestions: baseRule.meta.hasSuggestions,
messages: baseRule.meta.messages,
},
defaultOptions: [
Expand Down
5 changes: 4 additions & 1 deletion packages/eslint-plugin/src/rules/indent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import {
TSESTree,
AST_NODE_TYPES,
} from '@typescript-eslint/experimental-utils';
import baseRule from 'eslint/lib/rules/indent';
import { getESLintCoreRule } from '../util/getESLintCoreRule';
import * as util from '../util';

const baseRule = getESLintCoreRule('indent');

type Options = util.InferOptionsTypeFromRule<typeof baseRule>;
type MessageIds = util.InferMessageIdsTypeFromRule<typeof baseRule>;

Expand Down Expand Up @@ -96,6 +98,7 @@ export default util.createRule<Options, MessageIds>({
extendsBaseRule: true,
},
fixable: 'whitespace',
hasSuggestions: baseRule.meta.hasSuggestions,
schema: baseRule.meta.schema,
messages: baseRule.meta.messages ?? {
wrongIndentation:
Expand Down
5 changes: 4 additions & 1 deletion packages/eslint-plugin/src/rules/init-declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import {
TSESTree,
AST_NODE_TYPES,
} from '@typescript-eslint/experimental-utils';
import baseRule from 'eslint/lib/rules/init-declarations';
import { getESLintCoreRule } from '../util/getESLintCoreRule';
import {
InferOptionsTypeFromRule,
InferMessageIdsTypeFromRule,
createRule,
} from '../util';

const baseRule = getESLintCoreRule('init-declarations');

export type Options = InferOptionsTypeFromRule<typeof baseRule>;
export type MessageIds = InferMessageIdsTypeFromRule<typeof baseRule>;

Expand All @@ -23,6 +25,7 @@ export default createRule<Options, MessageIds>({
recommended: false,
extendsBaseRule: true,
},
hasSuggestions: baseRule.meta.hasSuggestions,
schema: baseRule.meta.schema,
messages: baseRule.meta.messages ?? {
initialized:
Expand Down
5 changes: 4 additions & 1 deletion packages/eslint-plugin/src/rules/keyword-spacing.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { AST_TOKEN_TYPES } from '@typescript-eslint/experimental-utils';
import baseRule from 'eslint/lib/rules/keyword-spacing';
import { getESLintCoreRule } from '../util/getESLintCoreRule';
import * as util from '../util';

const baseRule = getESLintCoreRule('keyword-spacing');

export type Options = util.InferOptionsTypeFromRule<typeof baseRule>;
export type MessageIds = util.InferMessageIdsTypeFromRule<typeof baseRule>;

Expand All @@ -16,6 +18,7 @@ export default util.createRule<Options, MessageIds>({
extendsBaseRule: true,
},
fixable: 'whitespace',
hasSuggestions: baseRule.meta.hasSuggestions,
schema: baseRule.meta.schema,
messages: baseRule.meta.messages ?? {
expectedBefore: 'Expected space(s) before "{{value}}".',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import {
AST_NODE_TYPES,
TSESTree,
} from '@typescript-eslint/experimental-utils';
import baseRule from 'eslint/lib/rules/lines-between-class-members';
import { getESLintCoreRule } from '../util/getESLintCoreRule';
import * as util from '../util';

const baseRule = getESLintCoreRule('lines-between-class-members');

type Options = util.InferOptionsTypeFromRule<typeof baseRule>;
type MessageIds = util.InferMessageIdsTypeFromRule<typeof baseRule>;

Expand All @@ -31,6 +33,7 @@ export default util.createRule<Options, MessageIds>({
extendsBaseRule: true,
},
fixable: 'whitespace',
hasSuggestions: baseRule.meta.hasSuggestions,
schema,
messages: baseRule.meta.messages ?? {
never: 'Unexpected blank line between class members.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default util.createRule({
recommended: false,
},
fixable: 'code',
hasSuggestions: true,
messages: {
confusingEqual:
'Confusing combinations of non-null assertion and equal test like "a! == b", which looks very similar to not equal "a !== b"',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default util.createRule<Options, MessageId>({
],
type: 'problem',
fixable: 'code',
hasSuggestions: true,
},
defaultOptions: [{}],

Expand Down
Loading