update eslint and simplify its config

This commit is contained in:
teoxoy
2024-12-09 02:55:17 +01:00
parent 1262502e9b
commit e275eeb8ec
13 changed files with 867 additions and 1337 deletions

View File

@@ -1,54 +0,0 @@
rules:
# Best Practices (https://eslint.org/docs/rules/#best-practices)
curly: [warn, all]
dot-notation: [error, allowPattern: '^[a-z]+(_[a-z]+)+$']
eqeqeq: [warn, always]
guard-for-in: error
no-new-func: error
no-new-wrappers: error
no-param-reassign: error
no-return-assign: [warn, always]
no-return-await: error
no-self-compare: error
no-sequences: error
no-throw-literal: error
no-unmodified-loop-condition: error
no-unused-expressions: error
no-useless-concat: error
no-useless-return: error
no-void: error
no-with: error
wrap-iife: [error, inside]
yoda: [error, never, exceptRange: true]
# Stylistic Issues (https://eslint.org/docs/rules/#stylistic-issues)
func-style: [error, declaration, allowArrowFunctions: true]
no-mixed-operators:
- error
- groups:
- ['&', '|', '^', '~', '<<', '>>', '>>>']
- ['==', '!=', '===', '!==', '>', '>=', '<', '<=']
- ['&&', '||']
- [in, instanceof]
allowSamePrecedence: true
no-multi-assign: error
no-negated-condition: error
no-new-object: error
no-plusplus: [error, allowForLoopAfterthoughts: true]
no-unneeded-ternary: error
operator-assignment: [error, always]
prefer-object-spread: error
spaced-comment:
- warn
- always
- block:
balanced: true
# ECMAScript 6 (https://eslint.org/docs/rules/#ecmascript-6)
arrow-body-style: [error, as-needed]
no-confusing-arrow: [error, allowParens: true]
no-var: error
prefer-const: error
prefer-rest-params: error
prefer-spread: error
prefer-template: error

View File

@@ -1,38 +0,0 @@
rules:
import/no-unresolved: error
import/named: error
# import/default: error
import/namespace: error
import/export: error
import/no-named-as-default: warn
# import/no-named-as-default-member: warn
import/no-duplicates: warn
import/first: warn
import/order:
- warn
- groups:
- builtin
- external
- internal
- unknown
- parent
- sibling
- index
newlines-between: never
import/no-useless-path-segments: error
import/no-self-import: error
import/no-absolute-path: error
import/no-commonjs: error
import/no-amd: error
import/no-extraneous-dependencies:
- error
- devDependencies: true
peerDependencies: false
optionalDependencies: false
import/exports-last: warn
# import/group-exports: warn
# import/no-default-export: error
import/no-mutable-exports: error
import/no-named-default: error

View File

@@ -1,32 +0,0 @@
rules:
# TODO: maybe turn on
# '@typescript-eslint/naming-convention':
# - error
# - selector: default
# format: [camelCase]
# TODO: turn on
'@typescript-eslint/ban-ts-comment': off
'@typescript-eslint/no-useless-constructor': warn
'@typescript-eslint/restrict-plus-operands': error
'@typescript-eslint/no-use-before-define': off
'@typescript-eslint/consistent-type-assertions':
- error
- assertionStyle: as
objectLiteralTypeAssertions: allow-as-parameter
'@typescript-eslint/explicit-member-accessibility': warn
'@typescript-eslint/explicit-function-return-type':
- warn
- allowExpressions: true
allowTypedFunctionExpressions: true
allowHigherOrderFunctions: true
'@typescript-eslint/member-ordering':
- warn
- default:
- signature
- static-field
- instance-field
- abstract-field
- constructor
- static-method
- instance-method
- abstract-method

View File

@@ -1,37 +0,0 @@
root: true
env:
es6: true
node: true
browser: true
parser: '@typescript-eslint/parser'
parserOptions:
sourceType: module
project:
- packages/*/tsconfig.json
- packages/*/tools/tsconfig.json
plugins:
- '@typescript-eslint'
- import
settings:
import/extensions: [.ts]
import/parsers:
'@typescript-eslint/parser': [.ts]
import/resolver:
typescript:
project:
- packages/*/tsconfig.json
- packages/*/tools/tsconfig.json
import/internal-regex: ^@fbe/
extends:
- eslint:recommended
- .eslint.base.yml
# Turn off eslint rules that conflict with typescript-eslint
- plugin:@typescript-eslint/recommended
- .eslint.typescript.yml
# Turn off eslint rules that conflict with prettier
- prettier
- .eslint.import.yml

2
.gitignore vendored
View File

@@ -1,5 +1,5 @@
node_modules
dist
packages/website/dist
packages/website/tools/.fusebox
packages/exporter/data/*
!packages/exporter/data/output

21
eslint.config.mjs Normal file
View File

@@ -0,0 +1,21 @@
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
export default tseslint.config(
eslint.configs.recommended,
tseslint.configs.recommended, // TODO: try strict & strictTypeChecked
{
rules: {
'@typescript-eslint/ban-ts-comment': 'off', // TODO: remove
'@typescript-eslint/no-explicit-any': 'off', // TODO: remove
},
},
{
ignores: [
'packages/website/dist',
'packages/editor/src/basis',
'packages/exporter',
'functions/corsproxy.js',
],
}
)

1997
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,19 +8,16 @@
"start:website": "npm --workspace=@fbe/website run start",
"start:exporter": "cd ./packages/exporter && cargo run --release",
"build:website": "npm --workspace=@fbe/website run build",
"lint": "eslint **/*.ts --config .eslintrc.yml --ignore-path .gitignore",
"lint:fix": "eslint **/*.ts --fix --config .eslintrc.yml --ignore-path .gitignore",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier . --check",
"format:fix": "prettier . --write"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
"eslint": "^8.4.1",
"eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-import": "^2.25.3",
"@eslint/js": "^9.16.0",
"eslint": "^9.16.0",
"prettier": "^3.4.2",
"typescript": "^4.5.4"
"typescript": "^4.5.4",
"typescript-eslint": "^8.17.0"
}
}

View File

@@ -147,7 +147,6 @@ export class PaintBlueprintContainer extends PaintContainer {
}
}
// eslint-disable-next-line @typescript-eslint/no-empty-function
protected redraw(): void {}
public placeEntityContainer(): void {

View File

@@ -60,7 +60,7 @@ export class PaintTileContainer extends PaintContainer {
this.redraw()
}
public rotate(ccw = false): void {
public rotate(): void {
const nD = FD.tiles[this.name].next_direction
if (nD) {
this.name = nD

View File

@@ -87,7 +87,7 @@ export class PaintWireContainer extends PaintContainer {
this.cursorBox?.destroy()
}
public rotate(ccw = false): void {
public rotate(): void {
if (!this.visible) return
// const cursor_position = this.getGridPosition()

View File

@@ -44,7 +44,6 @@ export class WireConnections extends EventEmitter {
const addConnSide = (side: string): void => {
if (connections[side]) {
// eslint-disable-next-line guard-for-in
for (const color in connections[side]) {
const conn = connections[side] as BPS.IConnSide
for (const data of conn[color]) {

View File

@@ -50,8 +50,6 @@ export function loadData(str: string): void {
export default FD
/* eslint-disable import/group-exports */
export interface Color {
r: number
g: number