Skip to content

Commit

Permalink
chore: update ESLint to v9 (#1064)
Browse files Browse the repository at this point in the history
Do Prettier linting separately as recommendeded.
  • Loading branch information
targos authored Jul 10, 2024
1 parent d28dd1a commit efb0b93
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 39 deletions.
25 changes: 0 additions & 25 deletions .eslintrc.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
lint:
name: Lint using ESLint
name: Lint using ESLint and Prettier

runs-on: ubuntu-latest

Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/README.md
/test/fixtures/custom-lookup-broken.json
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ This is for adding a module to be included in the default `citgm-all` runs.
- Module source code must be on Github.
- Published versions must include a tag on Github
- The test process must be executable with only the commands
`npm install && npm test` or (`yarn install && yarn test`
or `pnpm install && pnpm test`) using the tarball
downloaded from the Github tag mentioned above
`npm install && npm test` or (`yarn install && yarn test` or
`pnpm install && pnpm test`) using the tarball downloaded from the GitHub tag
mentioned above
- The tests pass on supported major release lines
- The maintainers of the module remain responsive when there are problems
- At least one module maintainer must be added to the lookup maintainers field
Expand Down
39 changes: 39 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import js from '@eslint/js';
import prettier from 'eslint-config-prettier';
import globals from 'globals';

export default [
js.configs.recommended,
prettier,
{
languageOptions: {
globals: {
...globals.node
}
},
rules: {
'capitalized-comments': [
'error',
'always',
{ ignoreConsecutiveComments: true }
],
eqeqeq: ['error', 'always'],
'no-template-curly-in-string': 'error',
'no-useless-escape': 'error',
'no-var': 'error',
'padding-line-between-statements': [
'error',
{ blankLine: 'always', prev: 'directive', next: '*' }
],
'prefer-arrow-callback': 'error',
'prefer-template': 'error',
strict: 'error'
}
},
{
files: ['test/fixtures/**'],
languageOptions: {
sourceType: 'commonjs'
}
}
];
2 changes: 1 addition & 1 deletion lib/lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function getLookupTable(options) {
}

return lookup;
} catch (err) {
} catch {
return undefined;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/lookup.json
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
"scripts": ["rebuild-tests", "test"],
"tags": "native",
"head": true,
"skip": [ "win32", "aix", "s390x"],
"skip": ["win32", "aix", "s390x"],
"comment": "Skipped while a proper solution is found"
},
"node-gyp": {
Expand Down
2 changes: 1 addition & 1 deletion lib/package-manager/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function test(packageManager, context) {
data = await readPackage(join(wd, 'package.json'), false);
// Explicitly set the version to the value in the downloaded package.json.
context.module.version = data.version;
} catch (err) {
} catch {
throw new Error('Package.json Could not be found');
}
if (
Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
"lib"
],
"scripts": {
"lint": "eslint bin/* lib/ test/ --cache",
"lint": "npm run lint:eslint && npm run lint:prettier",
"lint:eslint": "eslint . --cache",
"lint:eslint:fix": "npm run eslint -- --fix",
"lint:prettier": "prettier --check .",
"lint:prettier:fix": "prettier --write .",
"tap": "tap run \"test/**/test-*.js\"",
"test": "npm run lint && npm run tap"
},
Expand Down Expand Up @@ -56,11 +60,12 @@
"yarn": "^1.22.21"
},
"devDependencies": {
"@eslint/js": "^9.6.0",
"ansi-regex": "^6.0.1",
"eslint": "^8.56.0",
"eslint": "^9.6.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.1.1",
"globals": "^15.8.0",
"prettier": "^3.3.2",
"string-to-stream": "^3.0.1",
"tap": "^18.6.1",
"tap-parser": "^15.3.1",
Expand Down
2 changes: 0 additions & 2 deletions test/fixtures/.eslintrc.yml

This file was deleted.

2 changes: 1 addition & 1 deletion test/fixtures/package.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}

0 comments on commit efb0b93

Please sign in to comment.