Skip to content

Commit

Permalink
Bump to eslint v9
Browse files Browse the repository at this point in the history
  • Loading branch information
anoek committed Jul 18, 2024
1 parent 74fe290 commit 0548242
Show file tree
Hide file tree
Showing 6 changed files with 360 additions and 181 deletions.
116 changes: 0 additions & 116 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion engine/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "goban-engine",
"version": "8.3.15",
"version": "8.3.16",
"description": "",
"main": "build/goban-engine.js",
"types": "build/engine/index.d.ts",
Expand Down
164 changes: 164 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
import jsdoc from "eslint-plugin-jsdoc";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import prettier from "eslint-plugin-prettier";
import header from "@tony.ganchev/eslint-plugin-header";
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",
"src/third_party",
],
},
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"),
{
plugins: {
jsdoc,
"@typescript-eslint": typescriptEslint,
prettier,
header,
},

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

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

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

rules: {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-interface": "off",
"eqeqeq": ["error", "smart"],
"no-case-declarations": "off",
"no-constant-condition": "off",
"no-empty": "off",
"no-fallthrough": "off",
"no-self-assign": "off",
"@typescript-eslint/no-var-requires": "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/prefer-namespace-keyword": "error",
"@typescript-eslint/semi": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"computed-property-spacing": ["error", "never"],
"curly": "error",
"eol-last": "error",

"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",
"@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][)]))|(bin/env)",
},
],
],
},
},
{
files: ["src/test.tsx", "**/__tests__/*"],

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

parserOptions: {
project: null,
},
},

rules: {
"@typescript-eslint/no-floating-promises": "off",
},
},
];
20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "goban",
"version": "8.3.15",
"version": "8.3.16",
"description": "",
"main": "build/goban.js",
"types": "build/src/index.d.ts",
Expand All @@ -23,8 +23,8 @@
"dts": "dts-bundle-generator -o lib/goban.d.ts src/index.ts",
"dts-engine": "dts-bundle-generator -o engine/goban-engine.d.ts src/engine/index.ts",
"detect-duplicate-code": "jscpd --ignore '**/board_woods.ts' --ignore-pattern '.*place.*StoneSVG.*' --min-tokens 50 src/",
"lint": "eslint src/ --ext=.ts,.tsx",
"lint:fix": "eslint --fix src/ --ext=.ts,.tsx",
"lint": "eslint src/",
"lint:fix": "eslint --fix src/",
"typedoc": "typedoc --plugin typedoc-plugin-missing-exports src/index.ts ",
"typedoc:watch": "typedoc --watch src/index.ts",
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
Expand All @@ -45,27 +45,31 @@
},
"homepage": "https://github.com/online-go/goban#readme",
"devDependencies": {
"@eslint/compat": "^1.1.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.7.0",
"@types/cli-color": "^2.0.6",
"@types/jest": "^29.5.12",
"@types/node": "^18.15.5",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@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",
"bufferutil": "^4.0.7",
"canvas": "^2.10.2",
"cli-color": "^2.0.4",
"cspell": "^8.3.2",
"dts-bundle-generator": "^9.5.1",
"eslint": "^8.56.1",
"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-jsdoc": "^46.9.1",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unicorn": "^49.0.0",
"fork-ts-checker-webpack-plugin": "^9.0.0",
"globals": "^15.8.0",
"husky": "^8.0.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Expand All @@ -79,6 +83,7 @@
"react-dom": "^18.2.0",
"react-router": "^6.23.1",
"react-router-dom": "^6.23.1",
"stylus": "^0.63.0",
"svg-inline-loader": "0.8.2",
"thread-loader": "^3.0.4",
"ts-jest": "^29.1.4",
Expand All @@ -88,7 +93,6 @@
"typedoc": "^0.25.13",
"typedoc-plugin-missing-exports": "^2.3.0",
"typescript": "=5.5.2",
"stylus": "^0.63.0",
"utf-8-validate": "^6.0.3",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
Expand Down
1 change: 1 addition & 0 deletions src/Goban/themes/GobanTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ export class GobanTheme {
return stone;
}

/* Makes a unique id for a def element */
public def_uid(base: string): string {
const uid = last_def_uid++;

Expand Down
Loading

0 comments on commit 0548242

Please sign in to comment.