Skip to content

Commit

Permalink
Merge pull request #2757 from online-go/eslint-bump
Browse files Browse the repository at this point in the history
Bump eslint to v9
  • Loading branch information
anoek authored Jul 18, 2024
2 parents 535c9ac + 9133861 commit 70918c0
Show file tree
Hide file tree
Showing 7 changed files with 394 additions and 224 deletions.
140 changes: 0 additions & 140 deletions .eslintrc.js

This file was deleted.

187 changes: 187 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
import jsdoc from "eslint-plugin-jsdoc";
import header from "@tony.ganchev/eslint-plugin-header";
import prettier from "eslint-plugin-prettier";
import reactHooks from "eslint-plugin-react-hooks";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import { fixupPluginRules } from "@eslint/compat";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

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 [
{
ignores: ["**/node_modules", "**/dist", "**/i18n", "**/typings_manual", "**/.github"],
},
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"),
{
plugins: {
jsdoc,
header,
prettier,
"react-hooks": fixupPluginRules(reactHooks),
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
globals: {
...globals.browser,
},

parser: tsParser,
ecmaVersion: 5,
sourceType: "module",

parserOptions: {
project: "tsconfig.json",
},
},

rules: {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/triple-slash-reference": "off",
"no-misleading-character-class": "off",
"no-prototype-builtins": "off",
"no-self-assign": "off",
"no-useless-escape": "off",
"prefer-spread": "off",
"react-hooks/exhaustive-deps": "off",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/member-delimiter-style": "error",
"@typescript-eslint/no-floating-promises": "error",

"@typescript-eslint/no-inferrable-types": [
"error",
{
ignoreParameters: true,
ignoreProperties: true,
},
],

"@typescript-eslint/no-unused-vars": [
"error",
{
varsIgnorePattern: "^_[a-zA-Z_]",
argsIgnorePattern: "^_[a-zA-Z_]",
},
],

"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/semi": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"computed-property-spacing": ["error", "never"],
curly: "error",
"eol-last": "error",
eqeqeq: ["error", "smart"],

"id-denylist": [
"error",
"any",
"Number",
"number",
"String",
"string",
"Boolean",
"boolean",
"Undefined",
"undefined",
],

"id-match": "error",
"jsdoc/check-alignment": "error",
"jsdoc/require-asterisk-prefix": "error",
"linebreak-style": ["error", "unix"],
"no-caller": "error",
"no-cond-assign": "error",
"no-debugger": "error",
"no-eval": "error",

"no-fallthrough": [
"error",
{
commentPattern: "break[\\s\\w]*omitted",
},
],

"@typescript-eslint/no-invalid-this": "error",

"no-multiple-empty-lines": [
"error",
{
max: 3,
},
],

"no-new-wrappers": "error",
"no-tabs": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-unsafe-finally": "error",
"no-unused-labels": "error",
"no-var": "error",
"one-var": ["error", "never"],

"prefer-arrow-callback": [
"error",
{
allowNamedFunctions: true,
},
],

"prettier/prettier": "error",
"use-isnan": "error",

"header/header": [
"error",
"block",
[
{
pattern: "[Cc]opyright ([(][Cc][)])?\\s*[Oo]nline-[gG]o.com",
},
],
],

"react-hooks/rules-of-hooks": "error",

"prefer-const": [
"error",
{
destructuring: "all",
},
],
},
},
{
files: ["**/*.test.ts", "**/*.test.tsx"],

languageOptions: {
ecmaVersion: 5,
sourceType: "script",

parserOptions: {
project: null,
},
},

rules: {
"@typescript-eslint/no-floating-promises": "off",
},
},
];
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"prettier:check": "prettier --check \"src/**/*.{ts,tsx}\"",
"webpack": "webpack",
"webpack-watch": "webpack --watch --progress --color",
"lint": "eslint src/ --ext=.ts,.tsx -c .eslintrc.js",
"lint": "eslint src/",
"lintold": "eslint src/ --ext=.ts,.tsx -c .eslintrc.js",
"lint:fix": "eslint --fix src/ --ext=.ts,.tsx -c .eslintrc.js",
"test": "jest",
"fresh-test": "clear && jest",
Expand All @@ -27,25 +28,28 @@
"defaults"
],
"devDependencies": {
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.7.0",
"@google-cloud/translate": "^7.0.3",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.2.0",
"@types/jest": "^29.5.0",
"@types/react-linkify": "^1.0.4",
"@types/testing-library__jest-dom": "^5.14.5",
"@types/valid-url": "^1.0.7",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"autoprefixer": "^10.4.19",
"body-parser": "^1.20.2",
"circular-dependency-plugin": "^5.2.2",
"cspell": "^8.3.2",
"css-what": "^6.1.0",
"cssnano": "^6.0.1",
"deepl-node": "^1.10.1",
"eslint": "^8.56.0",
"eslint": "^9.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-header": "^3.1.1",
"@tony.ganchev/eslint-plugin-header": "^3.1.2",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsdoc": "^46.9.1",
"eslint-plugin-prefer-arrow": "^1.2.3",
Expand All @@ -55,10 +59,11 @@
"express": "^4.19.2",
"express-http-proxy": "^2.0.0",
"fork-ts-checker-webpack-plugin": "^9.0.0",
"globals": "^15.8.0",
"goban": "=8.3.16",
"gulp": "^5.0.0",
"gulp-clean-css": "^4.3.0",
"gulp-eslint-new": "^2.0.0",
"gulp-eslint-new": "^2.2.0",
"gulp-livereload": "^4.0.2",
"gulp-postcss": "^9.0.0",
"gulp-rename": "^2.0.0",
Expand Down
2 changes: 0 additions & 2 deletions src/components/Chat/ChatLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@ function saveSplitSizes(sizes: Array<number>): void {
}

export function ChatLog(props: ChatLogProperties): JSX.Element {
/* eslint-disable prefer-const */
let [showing_games, set_showing_games]: [boolean, (tf: boolean) => void] = useState(
data.get("chat.show-games", true) as boolean,
);
let [height, set_height]: [number, (tf: number) => void] = useState(document.body.clientHeight);
/* eslint-enable prefer-const */
const onShowGames = useCallback(
(tf: boolean) => {
//if (tf !== showing_games) {
Expand Down
Loading

0 comments on commit 70918c0

Please sign in to comment.