Skip to content

Commit 9d71f87

Browse files
Update eslint 8.57.0 → 9.10.0 (major) (#155)
* Update eslint to version 9.10.0 * new config * new config --------- Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> Co-authored-by: Gerben Meyer <gerben.meyer@gmail.com>
1 parent cb709de commit 9d71f87

File tree

5 files changed

+250
-135
lines changed

5 files changed

+250
-135
lines changed

.prettierrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"tabWidth": 2,
3+
"semi": true,
4+
"singleQuote": true,
5+
"printWidth": 200,
6+
"useTabs": false,
7+
"trailingComma": "all",
8+
"bracketSpacing": true,
9+
"arrowParens": "always"
10+
}

eslint.config.mjs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import prettier from 'eslint-plugin-prettier';
2+
import path from 'node:path';
3+
import { fileURLToPath } from 'node:url';
4+
import js from '@eslint/js';
5+
import { FlatCompat } from '@eslint/eslintrc';
6+
import { fixupPluginRules, fixupConfigRules } from '@eslint/compat';
7+
import importPlugin from 'eslint-plugin-import';
8+
9+
const __filename = fileURLToPath(import.meta.url);
10+
const __dirname = path.dirname(__filename);
11+
const compat = new FlatCompat({
12+
baseDirectory: __dirname,
13+
recommendedConfig: js.configs.recommended,
14+
allConfig: js.configs.all,
15+
});
16+
17+
export default [
18+
...fixupConfigRules(compat.extends('airbnb')),
19+
...compat.extends('prettier', 'plugin:prettier/recommended'),
20+
{
21+
plugins: {
22+
prettier,
23+
import: fixupPluginRules(importPlugin),
24+
},
25+
26+
languageOptions: {
27+
globals: {
28+
fetch: 'readonly',
29+
},
30+
},
31+
32+
settings: {
33+
'import/resolver': {
34+
node: {},
35+
exports: {},
36+
},
37+
},
38+
39+
rules: {
40+
'react/jsx-filename-extension': 'off',
41+
'no-underscore-dangle': 'off',
42+
'react/forbid-prop-types': 'off',
43+
'react/jsx-fragments': 'off',
44+
'import/no-named-as-default': 'off',
45+
'import/no-named-as-default-member': 'off',
46+
},
47+
},
48+
];

index.js

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ let configuration = {
1212
};
1313

1414
const parseValue = (value) => {
15-
if (
16-
value
17-
&& typeof value === 'object'
18-
&& value.constructor
19-
&& value.constructor.name
20-
&& value.constructor.name.endsWith('Error')
21-
) {
15+
if (value && typeof value === 'object' && value.constructor && value.constructor.name && value.constructor.name.endsWith('Error')) {
2216
const error = {
2317
error: value.constructor.name,
2418
message: value.message,
@@ -43,19 +37,22 @@ const logJSON = (level, ...values) => {
4337
message = values.map((v) => parseValue(v));
4438
}
4539
const objects = [];
46-
const json = JSON.stringify({
47-
level: level.toUpperCase(),
48-
message,
49-
// timestamp: new Date().toISOString(),
50-
}, (key, value) => {
51-
// Filtering out properties
52-
if (typeof value === 'object') {
53-
if (objects.includes(value)) return 'object';
54-
objects.push(value);
40+
const json = JSON.stringify(
41+
{
42+
level: level.toUpperCase(),
43+
message,
44+
// timestamp: new Date().toISOString(),
45+
},
46+
(key, value) => {
47+
// Filtering out properties
48+
if (typeof value === 'object') {
49+
if (objects.includes(value)) return 'object';
50+
objects.push(value);
51+
return value;
52+
}
5553
return value;
56-
}
57-
return value;
58-
});
54+
},
55+
);
5956
configuration.logger(json);
6057
if (callbacks[level]) {
6158
callbacks[level](json);

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,18 @@
2727
},
2828
"homepage": "https://github.com/sealninja/json-console-logger",
2929
"devDependencies": {
30-
"eslint": "8.57.0",
30+
"eslint": "9.10.0",
31+
"@eslint/compat": "1.1.1",
32+
"@eslint/eslintrc": "3.1.0",
33+
"@eslint/js": "9.9.1",
3134
"eslint-config-airbnb": "19.0.4",
35+
"eslint-config-prettier": "9.1.0",
3236
"eslint-plugin-import": "2.30.0",
3337
"eslint-plugin-jsx-a11y": "6.10.0",
38+
"eslint-plugin-prettier": "5.2.1",
3439
"eslint-plugin-react": "7.35.2",
35-
"eslint-plugin-react-hooks": "4.6.2",
36-
"jest": "27.5.1"
40+
"jest": "27.5.1",
41+
"prettier": "3.3.3"
42+
3743
}
3844
}

0 commit comments

Comments
 (0)