diff --git a/.eslintignore b/.eslintignore deleted file mode 120000 index 3e4e48b0b..000000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -.gitignore \ No newline at end of file diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 7da0646e3..000000000 --- a/.prettierignore +++ /dev/null @@ -1,18 +0,0 @@ -dist -cypress/platform/xss3.html -.cache -.pnpm-store -coverage -# Autogenerated by PNPM -pnpm-lock.yaml -stats -**/.vitepress/components.d.ts -**/.vitepress/cache -.nyc_output -# Autogenerated by `pnpm run --filter mermaid types:build-config` -packages/mermaid/src/config.type.ts -# autogenereated by langium-cli -generated/ -# Ignore the files creates in /demos/dev except for example.html -demos/dev/** -!/demos/dev/example.html diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index 28aa6e766..000000000 --- a/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "endOfLine": "auto", - "printWidth": 100, - "singleQuote": true, - "useTabs": false, - "tabWidth": 2, - "trailingComma": "es5" -} diff --git a/biome.json b/biome.json new file mode 100644 index 000000000..2b6609e68 --- /dev/null +++ b/biome.json @@ -0,0 +1,225 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.8.2/schema.json", + "files": { + "ignore": [ + "**/.DS_Store", + "**/.cache", + "**/.eslintcache", + "**/.idea/", + "**/.npmrc", + "**/.nyc_output", + "**/.pnpm-store/", + "**/.tsbuildinfo", + "**/.vitepress/cache", + "**/.vitepress/components.d.ts", + "**/Gemfile.lock", + "**/_site", + "**/contributor-names.json", + "**/coverage/", + "**/dist", + "**/generated/", + "**/knsv*.html", + "**/local*.html", + "**/local/", + "**/node_modules/", + "**/package-lock.json", + "**/pnpm-lock.yaml", + "**/stats/", + "**/token", + "**/tsconfig.tsbuildinfo", + "**/user-avatars/*", + "**/v8-compile-cache-0", + "**/vite.config.ts.timestamp-*", + "**/yarn-error.log", + "./.vscode/**", + "cypress/platform/current.html", + "cypress/platform/experimental.html", + "cypress/platform/xss3.html", + "cypress/screenshots/", + "cypress/snapshots/", + "demos/dev/**", + "packages/mermaid/src/config.type.ts", + "tsx-0/**" + ] + }, + "formatter": { + "enabled": true, + "formatWithErrors": false, + "indentStyle": "space", + "indentWidth": 2, + "lineEnding": "lf", + "lineWidth": 100, + "attributePosition": "auto" + }, + "organizeImports": { "enabled": false }, + "linter": { + "enabled": true, + "rules": { + "recommended": false, + "complexity": { + "noBannedTypes": "error", + "noExtraBooleanCast": "error", + "noMultipleSpacesInRegularExpressionLiterals": "error", + "noUselessCatch": "error", + "noUselessThisAlias": "error", + "noUselessTypeConstraint": "error", + "noWith": "error", + "useFlatMap": "error" + }, + "correctness": { + "noConstAssign": "error", + "noConstantCondition": "error", + "noEmptyCharacterClassInRegex": "error", + "noEmptyPattern": "error", + "noGlobalObjectCalls": "error", + "noInnerDeclarations": "error", + "noInvalidConstructorSuper": "error", + "noNewSymbol": "error", + "noNonoctalDecimalEscape": "error", + "noPrecisionLoss": "error", + "noSelfAssign": "error", + "noSetterReturn": "error", + "noSwitchDeclarations": "error", + "noUndeclaredVariables": "error", + "noUnreachable": "error", + "noUnreachableSuper": "error", + "noUnsafeFinally": "error", + "noUnsafeOptionalChaining": "error", + "noUnusedLabels": "error", + "noUnusedVariables": "warn", + "useArrayLiterals": "off", + "useIsNan": "error", + "useValidForDirection": "error", + "useYield": "error" + }, + "style": { + "noNamespace": "error", + "useAsConstAssertion": "error", + "useBlockStatements": "error", + "useForOf": "error", + "useImportType": "error", + "useNamingConvention": { + "level": "error", + "options": { "strictCase": false } + } + }, + "suspicious": { + "noAssignInExpressions": "error", + "noAsyncPromiseExecutor": "error", + "noCatchAssign": "error", + "noClassAssign": "error", + "noCompareNegZero": "error", + "noConsoleLog": "error", + "noControlCharactersInRegex": "error", + "noDebugger": "error", + "noDuplicateCase": "error", + "noDuplicateClassMembers": "error", + "noDuplicateObjectKeys": "error", + "noDuplicateParameters": "error", + "noEmptyBlockStatements": "error", + "noExplicitAny": "warn", + "noExtraNonNullAssertion": "error", + "noFallthroughSwitchClause": "error", + "noFunctionAssign": "error", + "noGlobalAssign": "error", + "noImportAssign": "error", + "noMisleadingCharacterClass": "error", + "noMisleadingInstantiator": "error", + "noPrototypeBuiltins": "off", + "noRedeclare": "error", + "noShadowRestrictedNames": "error", + "noUnsafeDeclarationMerging": "error", + "noUnsafeNegation": "error", + "useGetterReturn": "error", + "useIsArray": "error", + "useValidTypeof": "error" + } + } + }, + "javascript": { + "formatter": { + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "trailingCommas": "es5", + "semicolons": "always", + "arrowParentheses": "always", + "bracketSpacing": true, + "bracketSameLine": false, + "quoteStyle": "single", + "attributePosition": "auto" + }, + "globals": ["it", "describe", "beforeEach", "afterEach", "cy", "expect"] + }, + "overrides": [ + { + "include": ["cypress/**", "demos/**"], + "linter": { "rules": { "suspicious": { "noConsoleLog": "off" } } } + }, + { "include": ["*.{js,jsx,mjs,cjs}"], "linter": { "rules": {} } }, + { "include": ["*.{ts,tsx}"], "linter": { "rules": {} } }, + { + "include": ["*.spec.{ts,js}", "cypress/**", "demos/**", "**/docs/**"], + "linter": { "rules": { "correctness": { "noUnusedVariables": "off" } } } + }, + { + "include": ["*.spec.{ts,js}", "tests/**", "cypress/**/*.js"], + "linter": { "rules": {} } + }, + { + "include": ["*.html", "*.md", "**/*.md/*"], + "linter": { + "rules": { + "correctness": { + "noUndeclaredVariables": "off", + "noUnusedVariables": "off" + }, + "style": { "noVar": "error" } + } + } + }, + { "include": ["*.md"] }, + { + "include": ["**/*.md/**"], + "linter": { + "rules": { + "correctness": { + "noUndeclaredVariables": "off", + "noUnusedVariables": "off" + } + } + } + }, + { + "include": ["*.ts", "*.tsx", "*.mts", "*.cts"], + "linter": { + "rules": { + "correctness": { + "noConstAssign": "off", + "noGlobalObjectCalls": "off", + "noInvalidConstructorSuper": "off", + "noNewSymbol": "off", + "noSetterReturn": "off", + "noUndeclaredVariables": "off", + "noUnreachable": "off", + "noUnreachableSuper": "off" + }, + "style": { + "noArguments": "error", + "noVar": "error", + "useConst": "error" + }, + "suspicious": { + "noDuplicateClassMembers": "off", + "noDuplicateObjectKeys": "off", + "noDuplicateParameters": "off", + "noFunctionAssign": "off", + "noImportAssign": "off", + "noRedeclare": "off", + "noUnsafeNegation": "off", + "useGetterReturn": "off" + } + } + } + } + ] +} diff --git a/package.json b/package.json index deca7cc1b..7706c2706 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "dev:coverage": "pnpm coverage:cypress:clean && VITE_COVERAGE=true pnpm dev:vite", "release": "pnpm build", "lint": "cross-env NODE_OPTIONS=--max_old_space_size=8192 eslint --cache --cache-strategy content . && pnpm lint:jison && prettier --cache --check .", - "lint:fix": "cross-env NODE_OPTIONS=--max_old_space_size=8192 eslint --cache --cache-strategy content --fix . && prettier --write . && tsx scripts/fixCSpell.ts", + "lint:fix": "cross-env NODE_OPTIONS=--max_old_space_size=80192 eslint --cache --cache-strategy content --fix . && prettier --write . && tsx scripts/fixCSpell.ts", "lint:jison": "tsx ./scripts/jison/lint.mts", "contributors": "tsx scripts/updateContributors.ts", "cypress": "cypress run", @@ -51,18 +51,13 @@ "author": "Knut Sveidqvist", "license": "MIT", "standard": { - "ignore": [ - "**/parser/*.js", - "dist/**/*.js", - "cypress/**/*.js" - ], - "globals": [ - "page" - ] + "ignore": ["**/parser/*.js", "dist/**/*.js", "cypress/**/*.js"], + "globals": ["page"] }, "devDependencies": { "@applitools/eyes-cypress": "^3.42.3", "@argos-ci/cypress": "^2.0.5", + "@biomejs/biome": "1.8.2", "@cspell/eslint-plugin": "^8.6.0", "@cypress/code-coverage": "^3.12.30", "@rollup/plugin-typescript": "^11.1.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8ad6a05a7..8cbe4be80 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,6 +14,9 @@ importers: '@argos-ci/cypress': specifier: ^2.0.5 version: 2.0.5(cypress@13.7.3) + '@biomejs/biome': + specifier: 1.8.2 + version: 1.8.2 '@cspell/eslint-plugin': specifier: ^8.6.0 version: 8.7.0(eslint@8.57.0) @@ -1517,6 +1520,59 @@ packages: '@bcoe/v8-coverage@0.2.3': resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} + '@biomejs/biome@1.8.2': + resolution: {integrity: sha512-XafCzLgs0xbH0bCjYKxQ63ig2V86fZQMq1jiy5pyLToWk9aHxA8GAUxyBtklPHtPYZPGEPOYglQHj4jyfUp+Iw==} + engines: {node: '>=14.21.3'} + hasBin: true + + '@biomejs/cli-darwin-arm64@1.8.2': + resolution: {integrity: sha512-l9msLsTcSIAPqMsPIhodQmb50sEfaXPLQ0YW4cdj6INmd8iaOh/V9NceQb2366vACTJgcWDQ2RzlvURek1T68g==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [darwin] + + '@biomejs/cli-darwin-x64@1.8.2': + resolution: {integrity: sha512-Fc4y/FuIxRSiB3TJ+y27vFDE/HJt4QgBuymktsIKEcBZvnKfsRjxvzVDunccRn4xbKgepnp+fn6BoS+ZIg/I3Q==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [darwin] + + '@biomejs/cli-linux-arm64-musl@1.8.2': + resolution: {integrity: sha512-WpT41QJJvkZa1eZq0WmD513zkC6AYaMI39HJKmKeiUeX2NZirG+bxv1YRDhqkns1NbBqo3+qrJqBkPmOW+xAVA==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + + '@biomejs/cli-linux-arm64@1.8.2': + resolution: {integrity: sha512-Q99qwP0qibkZxm2kfnt37OxeIlliDYf5ogi3zX9ij2DULzc+KtPA9Uj0wCljcJofOBsBYaHc7597Q+Bf/251ww==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [linux] + + '@biomejs/cli-linux-x64-musl@1.8.2': + resolution: {integrity: sha512-rk1Wj4d3LIlAlIAS1m2jlyfOjkNbuY1lfwKvWIAeZC51yDMzwhRD7cReE5PE+jqLDtq60PX38hDPeKd7nA1S6A==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + + '@biomejs/cli-linux-x64@1.8.2': + resolution: {integrity: sha512-bjhhUVFchFid2gOjrvBe4fg8BShcpyFQTHuB/QQnfGxs1ddrGP30yq3fHfc6S6MoCcz9Tjd3Zzq1EfWfyy5iHA==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [linux] + + '@biomejs/cli-win32-arm64@1.8.2': + resolution: {integrity: sha512-EUbqmCmNWT5xhnxHrCAEBzJB1AnLqxTYoRjlxiCMzGvsy5jQzhCanJ8CT9kNsApW3pfPWBWkoTa7qrwWmwnEGA==} + engines: {node: '>=14.21.3'} + cpu: [arm64] + os: [win32] + + '@biomejs/cli-win32-x64@1.8.2': + resolution: {integrity: sha512-n9H5oRUCk1uNezMgyJh9+hZdtfD8PXLLeq8DUzTycIhl0I1BulIoZ/uxWgRVDFDwAR1JHu1AykISCRFNGnc4iA==} + engines: {node: '>=14.21.3'} + cpu: [x64] + os: [win32] + '@braintree/sanitize-url@7.0.1': resolution: {integrity: sha512-URg8UM6lfC9ZYqFipItRSxYJdgpU5d2Z4KnjsJ+rj6tgAmGme7E+PQNCiud8g0HDaZKMovu2qjfa0f5Ge0Vlsg==} @@ -11061,6 +11117,41 @@ snapshots: '@bcoe/v8-coverage@0.2.3': {} + '@biomejs/biome@1.8.2': + optionalDependencies: + '@biomejs/cli-darwin-arm64': 1.8.2 + '@biomejs/cli-darwin-x64': 1.8.2 + '@biomejs/cli-linux-arm64': 1.8.2 + '@biomejs/cli-linux-arm64-musl': 1.8.2 + '@biomejs/cli-linux-x64': 1.8.2 + '@biomejs/cli-linux-x64-musl': 1.8.2 + '@biomejs/cli-win32-arm64': 1.8.2 + '@biomejs/cli-win32-x64': 1.8.2 + + '@biomejs/cli-darwin-arm64@1.8.2': + optional: true + + '@biomejs/cli-darwin-x64@1.8.2': + optional: true + + '@biomejs/cli-linux-arm64-musl@1.8.2': + optional: true + + '@biomejs/cli-linux-arm64@1.8.2': + optional: true + + '@biomejs/cli-linux-x64-musl@1.8.2': + optional: true + + '@biomejs/cli-linux-x64@1.8.2': + optional: true + + '@biomejs/cli-win32-arm64@1.8.2': + optional: true + + '@biomejs/cli-win32-x64@1.8.2': + optional: true + '@braintree/sanitize-url@7.0.1': {} '@chevrotain/cst-dts-gen@11.0.3':