Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update eslint 8.57.0 → 9.10.0 (major) #155

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"printWidth": 200,
"useTabs": false,
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "always"
}
48 changes: 48 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import prettier from 'eslint-plugin-prettier';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
import { fixupPluginRules, fixupConfigRules } from '@eslint/compat';
import importPlugin from 'eslint-plugin-import';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
...fixupConfigRules(compat.extends('airbnb')),
...compat.extends('prettier', 'plugin:prettier/recommended'),
{
plugins: {
prettier,
import: fixupPluginRules(importPlugin),
},

languageOptions: {
globals: {
fetch: 'readonly',
},
},

settings: {
'import/resolver': {
node: {},
exports: {},
},
},

rules: {
'react/jsx-filename-extension': 'off',
'no-underscore-dangle': 'off',
'react/forbid-prop-types': 'off',
'react/jsx-fragments': 'off',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
},
},
];
35 changes: 16 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ let configuration = {
};

const parseValue = (value) => {
if (
value
&& typeof value === 'object'
&& value.constructor
&& value.constructor.name
&& value.constructor.name.endsWith('Error')
) {
if (value && typeof value === 'object' && value.constructor && value.constructor.name && value.constructor.name.endsWith('Error')) {
const error = {
error: value.constructor.name,
message: value.message,
Expand All @@ -43,19 +37,22 @@ const logJSON = (level, ...values) => {
message = values.map((v) => parseValue(v));
}
const objects = [];
const json = JSON.stringify({
level: level.toUpperCase(),
message,
// timestamp: new Date().toISOString(),
}, (key, value) => {
// Filtering out properties
if (typeof value === 'object') {
if (objects.includes(value)) return 'object';
objects.push(value);
const json = JSON.stringify(
{
level: level.toUpperCase(),
message,
// timestamp: new Date().toISOString(),
},
(key, value) => {
// Filtering out properties
if (typeof value === 'object') {
if (objects.includes(value)) return 'object';
objects.push(value);
return value;
}
return value;
}
return value;
});
},
);
configuration.logger(json);
if (callbacks[level]) {
callbacks[level](json);
Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@
},
"homepage": "https://github.com/sealninja/json-console-logger",
"devDependencies": {
"eslint": "8.57.0",
"eslint": "9.10.0",
"@eslint/compat": "1.1.1",
"@eslint/eslintrc": "3.1.0",
"@eslint/js": "9.9.1",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-import": "2.30.0",
"eslint-plugin-jsx-a11y": "6.10.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react": "7.35.2",
"eslint-plugin-react-hooks": "4.6.2",
"jest": "27.5.1"
"jest": "27.5.1",
"prettier": "3.3.3"

}
}
Loading
Loading