Skip to content

Commit

Permalink
Add eslint 8 test
Browse files Browse the repository at this point in the history
  • Loading branch information
D4N14L committed Sep 26, 2023
1 parent af3dc78 commit 995ab71
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 3 deletions.
25 changes: 25 additions & 0 deletions build-tests/eslint-8-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-8-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.
7 changes: 7 additions & 0 deletions build-tests/eslint-8-test/config/rig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// The "rig.json" file directs tools to look for their config files in an external package.
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",

"rigPackageName": "local-node-rig"
}
21 changes: 21 additions & 0 deletions build-tests/eslint-8-test/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "eslint-8-test",
"description": "This project contains a build test to validate ESLint 8 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",
"_phase:build": "heft run --only build -- --clean"
},
"devDependencies": {
"@rushstack/eslint-config": "workspace:*",
"@rushstack/heft": "workspace:*",
"local-node-rig": "workspace:*",
"@types/node": "18.17.15",
"@typescript-eslint/parser": "~5.59.2",
"eslint": "~8.7.0",
"typescript": "~5.0.4"
}
}
7 changes: 7 additions & 0 deletions build-tests/eslint-8-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-8-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"]
}
28 changes: 26 additions & 2 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/config/rush/repo-state.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
"pnpmShrinkwrapHash": "92561e650a0b5a0ffde5b5dcc107d597c755b413",
"pnpmShrinkwrapHash": "00aeb975643cac9bd71b0f5af110395618d2eedf",
"preferredVersionsHash": "1926a5b12ac8f4ab41e76503a0d1d0dccc9c0e06"
}
6 changes: 6 additions & 0 deletions rush.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,12 @@
"reviewCategory": "tests",
"shouldPublish": false
},
{
"packageName": "eslint-8-test",
"projectFolder": "build-tests/eslint-8-test",
"reviewCategory": "tests",
"shouldPublish": false
},
{
"packageName": "package-extractor-test-01",
"projectFolder": "build-tests/package-extractor-test-01",
Expand Down

0 comments on commit 995ab71

Please sign in to comment.