Skip to content

Commit

Permalink
Merge pull request #3057 from D4N14L/user/danade/eslint8
Browse files Browse the repository at this point in the history
[eslint-plugin] Support ESLint 8
  • Loading branch information
iclanton authored Dec 6, 2021
2 parents 7ae231e + 57dc5fd commit 3fea816
Show file tree
Hide file tree
Showing 69 changed files with 1,204 additions and 645 deletions.
2 changes: 1 addition & 1 deletion apps/heft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@rushstack/heft": "0.42.3",
"@rushstack/heft-node-rig": "1.2.32",
"@types/argparse": "1.0.38",
"@types/eslint": "7.2.0",
"@types/eslint": "8.2.0",
"@types/glob": "7.1.1",
"@types/heft-jest": "1.0.1",
"@types/node": "12.20.24",
Expand Down
2 changes: 1 addition & 1 deletion apps/heft/src/plugins/TypeScriptPlugin/Eslint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class Eslint extends LinterBase<TEslint.ESLint.LintResult> {
'Heft requires ESLint 7 or newer. Your ESLint version is too old:\n' + this._eslintPackagePath
);
}
if (majorVersion > 7) {
if (majorVersion > 8) {
// We don't use writeWarningLine() here because, if the person wants to take their chances with
// a newer ESLint release, their build should be allowed to succeed.
this._terminal.writeLine(
Expand Down
8 changes: 4 additions & 4 deletions apps/rush-lib/src/logic/taskRunner/BaseBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ export abstract class BaseBuilder {
/**
* Name of the task definition.
*/
abstract readonly name: string;
public abstract readonly name: string;

/**
* This flag determines if the task is allowed to be skipped if up to date.
*/
abstract isSkipAllowed: boolean;
public abstract isSkipAllowed: boolean;

/**
* Assigned by execute(). True if the build script was an empty string. Operationally an empty string is
* like a shell command that succeeds instantly, but e.g. it would be odd to report build time statistics for it.
*/
abstract hadEmptyScript: boolean;
public abstract hadEmptyScript: boolean;

/**
* Method to be executed for the task.
*/
abstract executeAsync(context: IBuilderContext): Promise<TaskStatus>;
public abstract executeAsync(context: IBuilderContext): Promise<TaskStatus>;
}
2 changes: 1 addition & 1 deletion build-tests-samples/heft-node-basic-tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@rushstack/heft-jest-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "12.20.24",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"typescript": "~4.4.2"
}
}
2 changes: 1 addition & 1 deletion build-tests-samples/heft-node-jest-tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@rushstack/heft-jest-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "12.20.24",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"typescript": "~4.4.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@types/react": "16.9.45",
"@types/webpack-env": "1.13.0",
"css-loader": "~4.2.1",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"heft-storybook-react-tutorial-storykit": "workspace:*",
"html-webpack-plugin": "~5.5.0",
"react-dom": "~16.13.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@types/react-dom": "16.9.8",
"@types/webpack-env": "1.13.0",
"css-loader": "~4.2.1",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"html-webpack-plugin": "~5.5.0",
"react": "~16.13.1",
"react-dom": "~16.13.1",
Expand Down
2 changes: 1 addition & 1 deletion build-tests-samples/packlets-tutorial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@types/node": "12.20.24",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"typescript": "~4.4.2"
}
}
25 changes: 25 additions & 0 deletions build-tests/eslint-7-test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');

module.exports = {
extends: [
'@rushstack/eslint-config/profile/node-trusted-tool',
'@rushstack/eslint-config/mixins/friendly-locals'
],
parserOptions: { tsconfigRootDir: __dirname },

overrides: [
/**
* Override the parser from @rushstack/eslint-config. Since the config is coming
* from the workspace instead of the external NPM package, the versions of ESLint
* and TypeScript that the config consumes will be resolved from the devDependencies
* of the config instead of from the eslint-7-test package. Overriding the parser
* ensures that the these dependencies come from the eslint-7-test package. See:
* https://github.com/microsoft/rushstack/issues/3021
*/
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser'
}
]
};
6 changes: 6 additions & 0 deletions build-tests/eslint-7-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# eslint-7-test

This project folder is one of the **build-tests** for the Rushstack [ESLint configuration](https://www.npmjs.com/package/@rushstack/eslint-config) (and by extension, the [ESLint plugin](https://www.npmjs.com/package/@rushstack/eslint-plugin))
package. This project builds using ESLint v7 and contains a simple index file to ensure that the build runs ESLint successfully against source code.

Please see the [ESLint Heft task documentation](https://rushstack.io/pages/heft_tasks/eslint/) for documentation and tutorials.
12 changes: 12 additions & 0 deletions build-tests/eslint-7-test/config/heft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/heft/heft.schema.json",

"eventActions": [
{
"actionKind": "deleteGlobs",
"heftEvent": "clean",
"actionId": "defaultClean",
"globsToDelete": ["lib", "temp"]
}
]
}
3 changes: 3 additions & 0 deletions build-tests/eslint-7-test/config/rush-project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"projectOutputFolderNames": ["lib"]
}
19 changes: 19 additions & 0 deletions build-tests/eslint-7-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "eslint-7-test",
"description": "This project contains a build test to validate ESLint 7 compatibility with the latest version of @rushstack/eslint-config (and by extension, the ESLint plugin)",
"version": "1.0.0",
"private": true,
"main": "lib/index.js",
"license": "MIT",
"scripts": {
"build": "heft build --clean"
},
"devDependencies": {
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@types/node": "12.20.24",
"@typescript-eslint/parser": "~5.3.0",
"eslint": "~7.30.0",
"typescript": "~4.4.2"
}
}
7 changes: 7 additions & 0 deletions build-tests/eslint-7-test/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.

export class Foo {
private _bar: string = 'bar';
public baz: string = this._bar;
}
24 changes: 24 additions & 0 deletions build-tests/eslint-7-test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "http://json.schemastore.org/tsconfig",

"compilerOptions": {
"outDir": "lib",
"rootDir": "src",

"forceConsistentCasingInFileNames": true,
"declaration": true,
"sourceMap": true,
"declarationMap": true,
"inlineSources": true,
"experimentalDecorators": true,
"strictNullChecks": true,
"noUnusedLocals": true,

"module": "esnext",
"moduleResolution": "node",
"target": "es5",
"lib": ["es5"]
},
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["node_modules", "lib"]
}
2 changes: 1 addition & 1 deletion build-tests/heft-action-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@types/node": "12.20.24",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"typescript": "~4.4.2"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion build-tests/heft-example-plugin-01/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@rushstack/heft": "workspace:*",
"@types/node": "12.20.24",
"@types/tapable": "1.0.6",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"typescript": "~4.4.2"
}
}
2 changes: 1 addition & 1 deletion build-tests/heft-example-plugin-02/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@types/node": "12.20.24",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"heft-example-plugin-01": "workspace:*",
"typescript": "~4.4.2"
}
Expand Down
2 changes: 1 addition & 1 deletion build-tests/heft-fastify-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@rushstack/heft": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "12.20.24",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"typescript": "~4.4.2"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion build-tests/heft-jest-reporters-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@rushstack/heft": "workspace:*",
"@rushstack/heft-jest-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"typescript": "~4.4.2",
"@jest/reporters": "~25.4.0",
"@jest/types": "~25.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@rushstack/heft-jest-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "12.20.24",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"heft-example-plugin-01": "workspace:*",
"heft-example-plugin-02": "workspace:*",
"tslint": "~5.20.1",
Expand Down
2 changes: 1 addition & 1 deletion build-tests/heft-node-everything-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@rushstack/heft-jest-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/node": "12.20.24",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"heft-example-plugin-01": "workspace:*",
"heft-example-plugin-02": "workspace:*",
"tslint": "~5.20.1",
Expand Down
2 changes: 1 addition & 1 deletion build-tests/heft-parameter-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"@types/node": "12.20.24",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"typescript": "~4.4.2"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion build-tests/heft-sass-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@types/webpack-env": "1.13.0",
"autoprefixer": "~9.8.0",
"css-loader": "~4.2.1",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"html-webpack-plugin": "~5.5.0",
"node-sass": "6.0.1",
"postcss": "7.0.32",
Expand Down
2 changes: 1 addition & 1 deletion build-tests/heft-typescript-composite-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@types/heft-jest": "1.0.1",
"@types/webpack-env": "1.13.0",
"@types/jest": "25.2.1",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"tslint": "~5.20.1",
"tslint-microsoft-contrib": "~6.2.0",
"typescript": "~4.4.2"
Expand Down
2 changes: 1 addition & 1 deletion build-tests/heft-webpack4-everything-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@rushstack/heft-webpack4-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/webpack-env": "1.13.0",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"file-loader": "~6.0.0",
"tslint": "~5.20.1",
"tslint-microsoft-contrib": "~6.2.0",
Expand Down
2 changes: 1 addition & 1 deletion build-tests/heft-webpack5-everything-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@rushstack/heft-webpack5-plugin": "workspace:*",
"@types/heft-jest": "1.0.1",
"@types/webpack-env": "1.13.0",
"eslint": "~7.30.0",
"eslint": "~8.3.0",
"tslint": "~5.20.1",
"tslint-microsoft-contrib": "~6.2.0",
"typescript": "~4.4.2"
Expand Down
Loading

0 comments on commit 3fea816

Please sign in to comment.