Skip to content

Commit 22d32ee

Browse files
chore: update ESLint stack and migrate to flat config (#1406)
* chore: update ESLint stack and migrate to flat config * update changelog
1 parent bee3070 commit 22d32ee

9 files changed

Lines changed: 546 additions & 1204 deletions

File tree

‎.eslintrc.json‎

Lines changed: 0 additions & 48 deletions
This file was deleted.

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
([#1404](https://github.com/pulumi/actions/pull/1404))
77
- chore: bump `typescript`, `jest`, `ts-jest`, `@types/jest`, `@types/node`
88
([#1405](https://github.com/pulumi/actions/pull/1405))
9+
- chore: update ESLint stack and migrate to flat config
10+
([#1406](https://github.com/pulumi/actions/pull/1406))
911

1012
---
1113

‎dist/index.js‎

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/index.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎eslint.config.js‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
const js = require('@eslint/js');
2+
const tseslint = require('typescript-eslint');
3+
const jestPlugin = require('eslint-plugin-jest');
4+
const importPlugin = require('eslint-plugin-import-x');
5+
const prettierConfig = require('eslint-config-prettier');
6+
const globals = require('globals');
7+
8+
module.exports = tseslint.config(
9+
{
10+
ignores: [
11+
'dist/**',
12+
'coverage/**',
13+
'build/**',
14+
'tmp/**',
15+
'.github/test-stacks/**',
16+
],
17+
},
18+
19+
js.configs.recommended,
20+
21+
{
22+
files: ['**/*.js', '**/*.cjs'],
23+
languageOptions: {
24+
sourceType: 'commonjs',
25+
globals: {
26+
...globals.node,
27+
},
28+
},
29+
},
30+
31+
{
32+
files: ['**/*.ts', '**/*.tsx'],
33+
extends: [...tseslint.configs.recommended],
34+
languageOptions: {
35+
parserOptions: {
36+
project: 'tsconfig.json',
37+
sourceType: 'module',
38+
},
39+
globals: {
40+
...globals.node,
41+
},
42+
},
43+
plugins: {
44+
jest: jestPlugin,
45+
import: importPlugin,
46+
},
47+
rules: {
48+
...jestPlugin.configs['flat/recommended'].rules,
49+
'sort-imports': ['error', { ignoreDeclarationSort: true }],
50+
'import/order': [
51+
'error',
52+
{ alphabetize: { order: 'asc' }, 'newlines-between': 'never' },
53+
],
54+
'no-return-await': 'error',
55+
'no-console': 'error',
56+
'import/no-default-export': 'error',
57+
'import/no-extraneous-dependencies': 'error',
58+
'import/no-unassigned-import': 'error',
59+
'@typescript-eslint/no-unused-vars': [
60+
'error',
61+
{ argsIgnorePattern: '^_', caughtErrors: 'all' },
62+
],
63+
'@typescript-eslint/no-unused-expressions': 'error',
64+
},
65+
},
66+
67+
{
68+
files: ['**/*.test.ts'],
69+
rules: {
70+
'@typescript-eslint/ban-ts-comment': 'off',
71+
'@typescript-eslint/no-explicit-any': 'off',
72+
'@typescript-eslint/no-unused-vars': 'off',
73+
'@typescript-eslint/no-require-imports': 'off',
74+
},
75+
},
76+
77+
prettierConfig,
78+
);

‎package.json‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,27 @@
2121
"*.md": "prettier --write"
2222
},
2323
"devDependencies": {
24+
"@eslint/js": "~10.0.1",
2425
"@types/dedent": "^0.7.0",
2526
"@types/faker": "^6.6.9",
2627
"@types/jest": "~30.0.0",
2728
"@types/node": "~24.0.0",
28-
"@typescript-eslint/eslint-plugin": "~4.33.0",
29-
"@typescript-eslint/parser": "~4.33.0",
3029
"@vercel/ncc": "^0.36.1",
31-
"eslint": "~7.32.0",
32-
"eslint-config-prettier": "~9.0.0",
33-
"eslint-plugin-import": "^2.27.5",
34-
"eslint-plugin-jest": "~27.6.0",
30+
"eslint": "~10.2.1",
31+
"eslint-config-prettier": "~10.1.8",
32+
"eslint-plugin-import-x": "~4.16.2",
33+
"eslint-plugin-jest": "~29.15.2",
3534
"faker": "^6.6.6",
35+
"globals": "~17.5.0",
3636
"husky": "^8.0.3",
3737
"jest": "~30.3.0",
3838
"jest-playback": "^3.0.0",
3939
"lint-staged": "^15.2.2",
4040
"prettier": "^2.8.8",
4141
"rimraf": "~5.0.1",
4242
"ts-jest": "~29.4.9",
43-
"typescript": "~5.9.3"
43+
"typescript": "~5.9.3",
44+
"typescript-eslint": "~8.59.1"
4445
},
4546
"dependencies": {
4647
"@actions/core": "^1.10.0",

‎src/config.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export function makeInstallationConfig(): rt.Result<InstallationConfig> {
4545
});
4646
}
4747

48-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
4948
export function makeConfig() {
5049
let pulumiVersion = getInput('pulumi-version');
5150
const versionFile = getInput('pulumi-version-file');

‎src/libs/__tests__/utils.test.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,13 @@ import { parseSemicolorToArray, stripAnsiControlCodes } from '../utils';
22

33
describe('utils.ts', () => {
44
it('should parse semicolon to array', () => {
5-
65
const inputArray = parseSemicolorToArray(['hello,world']);
76

87
expect(inputArray[0]).toBe('hello');
98
expect(inputArray[1]).toBe('world');
109
});
11-
});
12-
13-
describe('utils.ts', () => {
14-
it('should parse semicolon to array', () => {
1510

11+
it('should strip ansi control codes', () => {
1612
const output = stripAnsiControlCodes('\x1b[30mblack\x1b[37mwhite');
1713

1814
expect(output).toBe('blackwhite');

0 commit comments

Comments
 (0)