-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Add Biome.js for local linting #5587
base: develop
Are you sure you want to change the base?
Changes from all commits
2c80d80
08dfdfe
3381717
22a00a5
98f32bf
0a5315c
3a5793f
a23b891
ba34386
d2b42eb
e7577ed
55a8e4c
a1badd5
89e061a
054ed6c
48303a0
422b8cd
8cbe3e0
94fa235
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
export default { | ||
'!(docs/**/*)*.{ts,js,html,md,mts}': [ | ||
'eslint --cache --cache-strategy content --fix', | ||
// don't cache prettier yet, since we use `prettier-plugin-jsdoc`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can probably remove |
||
// and prettier doesn't invalidate cache on plugin updates" | ||
// https://prettier.io/docs/en/cli.html#--cache | ||
'prettier --write', | ||
'biome check --no-errors-on-unmatched --files-ignore-unknown=true --write', | ||
], | ||
'.cspell/*.txt': ['tsx scripts/fixCSpell.ts'], | ||
'**/*.jison': ['pnpm -w run lint:jison'], | ||
|
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.8.2/schema.json", | ||
"files": { | ||
"ignore": [ | ||
"**/contributor-names.json", | ||
"**/generated/", | ||
"**/knsv*.html", | ||
"**/local*.html", | ||
"**/stats/", | ||
"**/user-avatars/*", | ||
"./.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" | ||
] | ||
}, | ||
"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": "off", | ||
"useArrayLiterals": "off", | ||
"useIsNan": "error", | ||
"useValidForDirection": "error", | ||
"useYield": "error" | ||
}, | ||
"style": { | ||
"noNamespace": "error", | ||
"useAsConstAssertion": "error", | ||
"useBlockStatements": "error", | ||
"useForOf": "error", | ||
"useImportType": "error", | ||
"useNamingConvention": { | ||
"level": "off", | ||
"options": { "strictCase": false } | ||
} | ||
}, | ||
"suspicious": { | ||
"noAssignInExpressions": "warn", | ||
"noAsyncPromiseExecutor": "error", | ||
"noCatchAssign": "error", | ||
"noClassAssign": "error", | ||
"noCompareNegZero": "error", | ||
"noConsoleLog": "off", | ||
"noControlCharactersInRegex": "error", | ||
"noDebugger": "error", | ||
"noDuplicateCase": "error", | ||
"noDuplicateClassMembers": "error", | ||
"noDuplicateObjectKeys": "error", | ||
"noDuplicateParameters": "error", | ||
"noEmptyBlockStatements": "off", | ||
"noExplicitAny": "off", | ||
"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", | ||
"beforeAll", | ||
"afterEach", | ||
"cy", | ||
"expect", | ||
"context", | ||
"Cypress" | ||
] | ||
}, | ||
"overrides": [ | ||
{ | ||
"include": ["cypress/**", "demos/**", "**/scripts"], | ||
"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" }, | ||
"style": { | ||
"useNamingConvention": "off" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"include": ["*.spec.{ts,js}", "tests/**", "cypress/**/*.js"], | ||
"linter": { | ||
"rules": { | ||
"style": { | ||
"useNamingConvention": "off" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"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" | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"vcs": { | ||
"enabled": true, | ||
"clientKind": "git", | ||
"useIgnoreFile": true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -25,8 +25,9 @@ | |||||||||||||||||||||||||||||
"dev:vite": "tsx .vite/server.ts", | ||||||||||||||||||||||||||||||
"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": "pnpm biome check && pnpm lint:jison", | ||||||||||||||||||||||||||||||
"lint:fix": "pnpm biome check --write", | ||||||||||||||||||||||||||||||
"lint:ci": "pnpm lint && cross-env NODE_OPTIONS=--max_old_space_size=16384 eslint --cache --cache-strategy content .", | ||||||||||||||||||||||||||||||
Comment on lines
+28
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a big fan of making the CI linting different from local linting. It also means people will have to manually fix ESLint issues/CSpell issues. Having Would it be better to make a
Suggested change
If Whichever option you pick, please update all mentions of Lines 80 to 81 in 4a7489a
and mermaid/.github/workflows/lint.yml Lines 43 to 47 in 3a5793f
|
||||||||||||||||||||||||||||||
"lint:jison": "tsx ./scripts/jison/lint.mts", | ||||||||||||||||||||||||||||||
"contributors": "tsx scripts/updateContributors.ts", | ||||||||||||||||||||||||||||||
"cypress": "cypress run", | ||||||||||||||||||||||||||||||
|
@@ -51,18 +52,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", | ||||||||||||||||||||||||||||||
|
@@ -90,7 +86,7 @@ | |||||||||||||||||||||||||||||
"cypress-image-snapshot": "^4.0.1", | ||||||||||||||||||||||||||||||
"esbuild": "^0.20.2", | ||||||||||||||||||||||||||||||
"eslint": "^8.57.0", | ||||||||||||||||||||||||||||||
"eslint-config-prettier": "^9.1.0", | ||||||||||||||||||||||||||||||
"eslint-config-biome": "^1.7.3", | ||||||||||||||||||||||||||||||
"eslint-plugin-cypress": "^2.15.1", | ||||||||||||||||||||||||||||||
"eslint-plugin-html": "^8.0.0", | ||||||||||||||||||||||||||||||
"eslint-plugin-jest": "^27.9.0", | ||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds like
biome
doesn't yet support HTML and MD files:https://biomejs.dev/internals/language-support