Skip to content

Commit

Permalink
refactor: ♻️ migrated eslint v8 to v9 (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
WasiqB authored May 14, 2024
1 parent aedf5ee commit 30cd062
Show file tree
Hide file tree
Showing 7 changed files with 3,086 additions and 2,515 deletions.
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

28 changes: 0 additions & 28 deletions .eslintrc.json

This file was deleted.

6 changes: 5 additions & 1 deletion __tests__/index-nexus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ describe('test maven publish action', () => {
await index.runAction();
expect(runMock).toHaveReturned();

const pomPath = `${path.join(dir, 'java-test/nexus/without-gpg')}/pom.xml`;
const settingsPath = `${dir}/src/settings.xml`;

expect(debugMock).toHaveBeenNthCalledWith(1, 'Deploying the Maven project…');
expect(setFailedMock).toHaveBeenNthCalledWith(
1,
`Error encountered while running command: Command failed: mvn dummy --file ${path.join(dir, 'java-test/nexus/without-gpg')}/pom.xml --settings ${dir}/src/settings.xml --batch-mode`
`Error occurred:
Command failed: mvn dummy --file ${pomPath} --settings ${settingsPath} --batch-mode`
);
expect(setOutputMock).toHaveBeenNthCalledWith(1, 'published', false);
});
Expand Down
49 changes: 49 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import stylisticTs from '@stylistic/eslint-plugin-ts';
import stylisticJs from '@stylistic/eslint-plugin-js';
import tsParser from '@typescript-eslint/parser';
import js from '@eslint/js';
import prettierRecommended from 'eslint-plugin-prettier/recommended';
import tseslint from 'typescript-eslint';

export default [
js.configs.recommended,
prettierRecommended,
...tseslint.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
parser: tsParser,
},
files: ['src/**/*.ts', '__tests__/**/*.ts'],
ignores: [
'node_modules/',
'dist/',
'docs/',
'./javaTest/',
'.github/',
'pnpm-lock.yaml',
'*.xml',
'*.md',
'*.yml',
],
plugins: {
'@stylistic/ts': stylisticTs,
'@stylistic/js': stylisticJs,
},
rules: {
'@stylistic/ts/indent': ['error', 2],
'@stylistic/js/linebreak-style': ['error', 'unix'],
'@stylistic/ts/quotes': ['error', 'single'],
'@stylistic/ts/semi': ['error', 'always'],
'@stylistic/js/max-len': ['error', { code: 100 }],
'prefer-promise-reject-errors': ['off'],
'no-return-assign': ['off'],
'no-shadow': 'off',
'import/prefer-default-export': 'off',
'prettier/prettier': ['error', { singleQuote: true }],
'@typescript-eslint/no-explicit-any': ['off'],
'@typescript-eslint/explicit-function-return-type': ['error'],
},
},
];
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,34 @@
},
"scripts": {
"bundle": "npm run format:fix && npm run package",
"lint": "eslint 'src/*.ts'",
"lint:fix": "eslint --fix src/**.ts",
"format": "prettier --check src/**.ts",
"format:fix": "prettier --write src/**.ts",
"lint": "eslint 'src/*.ts' '__tests__/*.ts'",
"lint:fix": "eslint --fix 'src/*.ts' '__tests__/*.ts'",
"format": "prettier --check 'src/*.ts' '__tests__/*.ts'",
"format:fix": "prettier --write 'src/*.ts' '__tests__/*.ts'",
"package": "ncc build src/index.ts -o dist --minify -a --license license.txt",
"test": "jest"
},
"devDependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@eslint/js": "^9.2.0",
"@stylistic/eslint-plugin-js": "^2.1.0",
"@stylistic/eslint-plugin-ts": "^2.1.0",
"@tsconfig/node18": "^18.2.4",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.11",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"eslint": "8.57.0",
"@types/node": "^20.12.12",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"eslint": "9.2.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"prettier": "^3.2.5",
"ts-jest": "^29.1.1",
"typescript": "^5.4.5"
"ts-jest": "^29.1.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.9.0"
},
"jest": {
"preset": "ts-jest",
Expand Down
Loading

0 comments on commit 30cd062

Please sign in to comment.