-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for oldest and newest supported versions of eslint.
- Loading branch information
Showing
21 changed files
with
897 additions
and
4 deletions.
There are no files selected for viewing
139 changes: 139 additions & 0 deletions
139
build-tests/eslint-bulk-suppressions-newest-test/client/.eslint-bulk-suppressions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
{ | ||
"suppressions": [ | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".", | ||
"rule": "prefer-const" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".ExampleClass", | ||
"rule": "@typescript-eslint/ban-types" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".ExampleClass", | ||
"rule": "@typescript-eslint/explicit-member-accessibility" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".ExampleClass.exampleMethod", | ||
"rule": "@typescript-eslint/explicit-function-return-type" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".ExampleClass.exampleMethod", | ||
"rule": "@typescript-eslint/explicit-member-accessibility" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".ExampleClass.exampleMethod", | ||
"rule": "@typescript-eslint/typedef" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".ExampleClass.exampleMethod", | ||
"rule": "no-var" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleAnonymousClass", | ||
"rule": "@typescript-eslint/explicit-member-accessibility" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleAnonymousClass", | ||
"rule": "@typescript-eslint/typedef" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleAnonymousClass", | ||
"rule": "no-useless-concat" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleAnonymousClass.constructor", | ||
"rule": "@typescript-eslint/explicit-member-accessibility" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleAnonymousClass.exampleSetGet", | ||
"rule": "@typescript-eslint/ban-types" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleAnonymousClass.exampleSetGet", | ||
"rule": "@typescript-eslint/explicit-function-return-type" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleAnonymousClass.exampleSetGet", | ||
"rule": "@typescript-eslint/explicit-member-accessibility" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleArrowFunction", | ||
"rule": "@typescript-eslint/explicit-function-return-type" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleArrowFunction", | ||
"rule": "@typescript-eslint/typedef" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleArrowFunction", | ||
"rule": "dot-notation" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleArrowFunction", | ||
"rule": "no-empty" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleArrowFunction", | ||
"rule": "no-unused-expressions" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleFunction", | ||
"rule": "@typescript-eslint/ban-types" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleFunction", | ||
"rule": "@typescript-eslint/explicit-function-return-type" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleFunction", | ||
"rule": "no-empty-pattern" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleFunction", | ||
"rule": "no-extra-boolean-cast" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleObject", | ||
"rule": "@typescript-eslint/typedef" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".x", | ||
"rule": "@typescript-eslint/explicit-function-return-type" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".y", | ||
"rule": "@typescript-eslint/explicit-function-return-type" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".z", | ||
"rule": "@typescript-eslint/explicit-function-return-type" | ||
} | ||
] | ||
} |
32 changes: 32 additions & 0 deletions
32
build-tests/eslint-bulk-suppressions-newest-test/client/.eslintrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
|
||
// This is a workaround for https://github.com/eslint/eslint/issues/3458 | ||
require('local-node-rig/profiles/default/includes/eslint/patch/modern-module-resolution'); | ||
// This is a workaround for https://github.com/microsoft/rushstack/issues/3021 | ||
require('local-node-rig/profiles/default/includes/eslint/patch/custom-config-package-names'); | ||
require('local-node-rig/profiles/default/includes/eslint/patch/eslint-bulk-suppressions'); | ||
|
||
module.exports = { | ||
extends: [ | ||
'local-node-rig/profiles/default/includes/eslint/profile/node-trusted-tool', | ||
'local-node-rig/profiles/default/includes/eslint/mixins/friendly-locals' | ||
], | ||
ignorePatterns: ['.eslintrc.js'], | ||
|
||
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-8-test package. Overriding the parser | ||
* ensures that the these dependencies come from the eslint-8-test package. See: | ||
* https://github.com/microsoft/rushstack/issues/3021 | ||
*/ | ||
{ | ||
files: ['**/*.ts', '**/*.tsx'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { project: '../tsconfig.json', tsconfigRootDir: __dirname } | ||
} | ||
] | ||
}; |
64 changes: 64 additions & 0 deletions
64
build-tests/eslint-bulk-suppressions-newest-test/client/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
|
||
/* Top-level scope code samples */ | ||
// scopeId: '.' | ||
let exampleString: string = 5 + ''; | ||
|
||
const exampleObject = { | ||
exampleString: exampleString | ||
}; | ||
|
||
/* Function scope code samples */ | ||
export function exampleFunction() { | ||
const {}: Object = exampleObject; | ||
|
||
// scopeId: '.exampleFunction' | ||
!!!exampleString as Boolean; | ||
} | ||
|
||
// scope: '.ArrowFunctionExpression', | ||
export const x = () => {}, | ||
// scopeId: '.y' | ||
y = () => {}, | ||
// scopeId: '.z' | ||
z = () => {}; | ||
|
||
/* Class scope code samples */ | ||
export class ExampleClass { | ||
// scopeId: '.ExampleClass' | ||
exampleClassProperty: String = exampleString + '4'; | ||
|
||
exampleMethod() { | ||
// scopeId: '.exampleClass.exampleMethod' | ||
var exampleVar; | ||
return exampleVar; | ||
} | ||
} | ||
|
||
/* Variable and anonymous constructs code samples */ | ||
export const exampleArrowFunction = () => { | ||
const exampleBoolean = true; | ||
if (exampleBoolean) { | ||
} | ||
|
||
exampleObject['exampleString']; | ||
}; | ||
|
||
export const exampleAnonymousClass = class { | ||
exampleClassProperty = 'x' + 'y'; | ||
|
||
// scopeId: '.exampleAnonymousClass.constructor' | ||
constructor() {} | ||
|
||
set exampleSetGet(val: string) { | ||
// scopeId: '.exampleAnonymousClass.exampleSetGet' | ||
let exampleVariable: Number = 1; | ||
this.exampleClassProperty = val + exampleVariable; | ||
} | ||
|
||
get exampleSetGet() { | ||
// scopeId: '.exampleAnonymousClass.exampleSetGet' | ||
return this.exampleClassProperty as String as string; | ||
} | ||
}; |
7 changes: 7 additions & 0 deletions
7
build-tests/eslint-bulk-suppressions-newest-test/config/rig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
16 changes: 16 additions & 0 deletions
16
build-tests/eslint-bulk-suppressions-newest-test/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "eslint-bulk-suppressions-newest-test", | ||
"description": "Sample code to test eslint bulk suppressions", | ||
"version": "1.0.0", | ||
"private": true, | ||
"scripts": { | ||
"_phase:build": "eslint ." | ||
}, | ||
"devDependencies": { | ||
"@rushstack/heft": "workspace:*", | ||
"local-node-rig": "workspace:*", | ||
"@typescript-eslint/parser": "~6.19.0", | ||
"eslint": "~8.23.1", | ||
"typescript": "~5.3.3" | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
build-tests/eslint-bulk-suppressions-newest-test/server/.eslint-bulk-suppressions.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"suppressions": [ | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".", | ||
"rule": "@typescript-eslint/no-namespace" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".AbsurdClass.absurdClassMethod", | ||
"rule": "@typescript-eslint/explicit-function-return-type" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".AbsurdClass.absurdClassMethod", | ||
"rule": "@typescript-eslint/explicit-member-accessibility" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".AbsurdClass.absurdClassMethod.AbsurdClass2", | ||
"rule": "@typescript-eslint/explicit-member-accessibility" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".AbsurdClass.absurdClassMethod.AbsurdClass2", | ||
"rule": "@typescript-eslint/typedef" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".AbsurdClass.absurdClassMethod.AbsurdClass2.constructor", | ||
"rule": "@typescript-eslint/explicit-member-accessibility" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".AbsurdClass.absurdClassMethod.AbsurdClass2.constructor.absurdObject", | ||
"rule": "@typescript-eslint/typedef" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".ExampleEnum", | ||
"rule": "dot-notation" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".ExampleInterface", | ||
"rule": "@typescript-eslint/naming-convention" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".ExampleInterface2", | ||
"rule": "@typescript-eslint/naming-convention" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".ExampleObjectType", | ||
"rule": "@typescript-eslint/ban-types" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".ExampleObjectType", | ||
"rule": "@typescript-eslint/consistent-type-definitions" | ||
}, | ||
{ | ||
"file": "src/index.ts", | ||
"scopeId": ".exampleObject2", | ||
"rule": "@typescript-eslint/typedef" | ||
} | ||
] | ||
} |
32 changes: 32 additions & 0 deletions
32
build-tests/eslint-bulk-suppressions-newest-test/server/.eslintrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
|
||
// This is a workaround for https://github.com/eslint/eslint/issues/3458 | ||
require('local-node-rig/profiles/default/includes/eslint/patch/modern-module-resolution'); | ||
// This is a workaround for https://github.com/microsoft/rushstack/issues/3021 | ||
require('local-node-rig/profiles/default/includes/eslint/patch/custom-config-package-names'); | ||
require('local-node-rig/profiles/default/includes/eslint/patch/eslint-bulk-suppressions'); | ||
|
||
module.exports = { | ||
extends: [ | ||
'local-node-rig/profiles/default/includes/eslint/profile/node-trusted-tool', | ||
'local-node-rig/profiles/default/includes/eslint/mixins/friendly-locals' | ||
], | ||
ignorePatterns: ['.eslintrc.js'], | ||
|
||
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-8-test package. Overriding the parser | ||
* ensures that the these dependencies come from the eslint-8-test package. See: | ||
* https://github.com/microsoft/rushstack/issues/3021 | ||
*/ | ||
{ | ||
files: ['**/*.ts', '**/*.tsx'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { project: '../tsconfig.json', tsconfigRootDir: __dirname } | ||
} | ||
] | ||
}; |
Oops, something went wrong.