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

Upgrade ESLint packages #235

Merged
merged 1 commit into from
Dec 19, 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
48 changes: 0 additions & 48 deletions .eslintrc.json

This file was deleted.

111 changes: 111 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import mochaPlugin from 'eslint-plugin-mocha';
import noOnlyTestsPlugin from 'eslint-plugin-no-only-tests';
import reactPlugin from 'eslint-plugin-react';
import globals from 'globals';

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

export default [
...compat.extends(
'eslint:recommended',
'plugin:mocha/recommended',
'plugin:react/recommended'
),
{
settings: {
react: {
version: 'detect'
}
}
},
{
ignores: [
'built/*',
'public/*'
]
},
{
languageOptions: {
globals: {
...globals.node
},
ecmaVersion: 2020,
sourceType: 'module'
},
rules: {
'comma-dangle': 2,
eqeqeq: 2,
'guard-for-in': 2,
'new-cap': 0,
'no-caller': 2,
'no-console': 2,
'no-extend-native': 2,
'no-irregular-whitespace': 2,
'no-loop-func': 2,
'no-multi-spaces': 2,
'no-multiple-empty-lines': [2, { max: 1 }],
'no-undef': 2,
'no-underscore-dangle': 0,
'no-unused-vars': 2,
'no-var': 2,
'one-var': [2, 'never'],
quotes: [2, 'single'],
semi: 2,
'space-before-function-paren': 2,
'spaced-comment': 2,
strict: [2, 'global'],
'wrap-iife': 2
}
},
{
files: [
'**/*.jsx'
],
languageOptions: {
globals: {
...globals.browser
},
parserOptions: {
ecmaFeatures: {
jsx: true
}
}
},
plugins: {
react: reactPlugin
},
rules: {
'react/react-in-jsx-scope': 0
}
},
{
files: [
'test/**/*.test.js'
],
languageOptions: {
globals: {
...globals.mocha
}
},
plugins: {
mocha: mochaPlugin,
'no-only-tests': noOnlyTestsPlugin
},
rules: {
'mocha/no-mocha-arrows': 0,
'no-only-tests/no-only-tests': 2
}
}
];
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "MS-RSL",
"main": "src/server/app.js",
"scripts": {
"lint": "eslint --ext .js,.jsx src/ test/",
"lint": "eslint",
"lintspaces": "git ls-files ':!:*.ico' | xargs lintspaces -e .editorconfig",
"lint-check": "npm run lint && npm run lintspaces",
"unit-test": "mocha --config test/.mocharc.json",
Expand Down Expand Up @@ -55,10 +55,11 @@
"@rollup/plugin-replace": "6.0.1",
"chai": "5.1.2",
"concurrently": "9.1.0",
"eslint": "8.57.0",
"eslint-plugin-mocha": "^10.4.3",
"eslint-plugin-no-only-tests": "3.1.0",
"eslint-plugin-react": "7.34.2",
"eslint": "9.17.0",
"eslint-plugin-mocha": "10.5.0",
"eslint-plugin-no-only-tests": "3.3.0",
"eslint-plugin-react": "7.37.2",
"globals": "15.14.0",
"lintspaces-cli": "0.8.0",
"mocha": "10.4.0",
"pre-commit": "1.2.2",
Expand Down
4 changes: 2 additions & 2 deletions src/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import http from 'node:http';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __filename = fileURLToPath(import.meta.url); // eslint-disable-line no-underscore-dangle
const __dirname = path.dirname(__filename); // eslint-disable-line no-underscore-dangle
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

import express from 'express';
import { engine } from 'express-handlebars';
Expand Down
16 changes: 0 additions & 16 deletions test/.eslintrc.json

This file was deleted.