Skip to content

Commit

Permalink
chore(eslint): migrate to eslint 9
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Oct 5, 2024
1 parent a21f2cc commit 860171c
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 21 deletions.
14 changes: 0 additions & 14 deletions .eslintrc.json

This file was deleted.

10 changes: 9 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'daily'
groups:
eslint:
patterns:
- '@eslint/*'
prettier:
patterns:
- prettier
- eslint-plugin-prettier

- package-ecosystem: 'github-actions'
directory: '/'
Expand Down
40 changes: 40 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import prettier from 'eslint-plugin-prettier';
import globals from 'globals';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
import { includeIgnoreFile } from '@eslint/compat';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, '.gitignore');

const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
includeIgnoreFile(gitignorePath),

...compat.extends('eslint:recommended'),

{
plugins: {
prettier,
},

languageOptions: {
globals: {
...globals.jest,
...globals.node,
},
},

rules: {
'prettier/prettier': 'error',
},
},
];
65 changes: 59 additions & 6 deletions package-lock.json

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

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@
"request": "2.88.2"
},
"devDependencies": {
"@eslint/compat": "1.2.0",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.12.0",
"eslint": "9.12.0",
"eslint-plugin-prettier": "5.2.1",
"globals": "15.10.0",
"jest": "29.7.0",
"nock": "13.5.5",
"nodemon": "3.1.7",
Expand Down
1 change: 1 addition & 0 deletions routes/v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module.exports = router.all('/cors', (req, res) => {
try {
contentType.parse(fieldValue);
// TypeError: invalid media type
// eslint-disable-next-line no-unused-vars
} catch (error) {
res.status(500);
res.send('Invalid "Content-Type" parameter.');
Expand Down

0 comments on commit 860171c

Please sign in to comment.