-
Notifications
You must be signed in to change notification settings - Fork 19
chore(monorepo): π€ make linting, formatting centralized #955
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
base: chore/design-tokens-package
Are you sure you want to change the base?
Changes from all commits
3ade323
8511f1e
a788d8e
b922b20
74d62f2
31f9637
76d3e40
faa3f91
ce767c5
3fc9993
3b007a8
1270a82
8443376
e8ab91b
8f24d86
fb80f48
b43d4e5
548f696
af27131
6b7a58d
f6c22c1
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 |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| /** | ||
| * Shared ESLint configuration for TypeScript packages. | ||
| * | ||
| * Important: | ||
| * - Packages should create their own eslint.config.ts that imports and extends this. | ||
| * - React/Storybook-specific plugins and rules should be added at the package level. | ||
| * | ||
| * Excluded packages (using alternative linters): | ||
| * - design-tokens: uses Terrazzo's linter (tz lint) | ||
| */ | ||
| import js from '@eslint/js'; | ||
| import tseslint from 'typescript-eslint'; | ||
| import preferArrowFunctions from 'eslint-plugin-prefer-arrow-functions'; | ||
| import importPlugin from 'eslint-plugin-import'; | ||
| import globals from 'globals'; | ||
| import type { Linter } from 'eslint'; | ||
|
|
||
| export const ignores = { | ||
| ignores: [ | ||
| '**/dist/**', | ||
| '**/node_modules/**', | ||
| '**/build/**', | ||
| '**/coverage/**', | ||
| '**/*.d.ts', | ||
| ], | ||
| }; | ||
|
|
||
| export const baseConfigs = [js.configs.recommended, ...tseslint.configs.recommended]; | ||
|
|
||
| export const plugins = { | ||
| 'prefer-arrow-functions': preferArrowFunctions, | ||
| import: importPlugin, | ||
| }; | ||
|
|
||
| export const sharedLanguageOptions = { | ||
| ecmaVersion: 'latest' as const, | ||
| sourceType: 'module' as const, | ||
| parser: tseslint.parser, | ||
| parserOptions: { | ||
| ecmaFeatures: { | ||
| jsx: true, | ||
| }, | ||
| }, | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.es2020, | ||
| }, | ||
| }; | ||
|
|
||
| export const sharedRules: Linter.RulesRecord = { | ||
| curly: ['error', 'all'], | ||
| 'no-multiple-empty-lines': 'error', | ||
| quotes: ['error', 'single', { avoidEscape: true }], | ||
| 'arrow-parens': ['error', 'as-needed'], | ||
| 'prefer-arrow-functions/prefer-arrow-functions': [ | ||
| 'warn', | ||
| { | ||
| classPropertiesAllowed: false, | ||
| disallowPrototype: false, | ||
| returnStyle: 'unchanged', | ||
| singleReturnOnly: false, | ||
| }, | ||
| ], | ||
| '@typescript-eslint/no-empty-object-type': 'off', | ||
| 'import/extensions': [ | ||
| 'error', | ||
| 'ignorePackages', | ||
| { | ||
| js: 'never', | ||
| jsx: 'never', | ||
| ts: 'never', | ||
| tsx: 'never', | ||
| }, | ||
| ], | ||
| 'import/no-cycle': [ | ||
| 'error', | ||
| { | ||
| maxDepth: 10, | ||
| ignoreExternal: true, | ||
| allowUnsafeDynamicCyclicDependency: false, | ||
| }, | ||
| ], | ||
| 'import/no-self-import': 'error', | ||
| '@typescript-eslint/no-deprecated': 'warn', | ||
| }; | ||
|
|
||
| export const testFileRules: Linter.RulesRecord = { | ||
| '@typescript-eslint/no-unused-expressions': 'off', | ||
| }; | ||
|
|
||
| export { tseslint }; |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,10 @@ | ||||||||
| { | ||||||||
| "extends": "../../tsconfig.eslint.json", | ||||||||
| "compilerOptions": { | ||||||||
| "baseUrl": ".", | ||||||||
| "paths": { | ||||||||
| "@/*": ["src/*"] | ||||||||
| } | ||||||||
|
||||||||
| } | |
| }, | |
| "types": ["vitest/globals", "@testing-library/jest-dom"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,14 @@ | ||
| { | ||
| "extends": "../../tsconfig.base.json", | ||
| "compilerOptions": { | ||
| "target": "ESNext", | ||
| "esModuleInterop": true, | ||
| "lib": ["DOM", "DOM.Iterable", "ESNext"], | ||
| "module": "ESNext", | ||
| "skipLibCheck": true, | ||
|
|
||
| /* Bundler mode */ | ||
| "moduleResolution": "bundler", | ||
| "allowImportingTsExtensions": true, | ||
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "noEmit": true, | ||
| "jsx": "react-jsx", | ||
|
|
||
| /* Linting */ | ||
| "strict": true, | ||
| "noUnusedLocals": true, | ||
| "noUnusedParameters": true, | ||
| "noFallthroughCasesInSwitch": true, | ||
| "paths": { | ||
| "@/*": ["./src/*"], | ||
| "@/*": ["./src/*"] | ||
| }, | ||
| "types": ["@testing-library/jest-dom", "vitest/globals"] | ||
| }, | ||
| "include": ["src"], | ||
| "exclude": [ | ||
| "node_modules", | ||
| "dist", | ||
| ], | ||
| "references": [{ "path": "./tsconfig.node.json" }] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,4 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "target": "ESNext", | ||
| "module": "ESNext", | ||
| "moduleResolution": "bundler", | ||
| "esModuleInterop": true, | ||
| "skipLibCheck": true, | ||
| "strict": true, | ||
| "noUnusedLocals": true, | ||
| "noUnusedParameters": true, | ||
| "noFallthroughCasesInSwitch": true, | ||
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "noEmit": true | ||
| }, | ||
| "include": ["*.ts"], | ||
| "exclude": ["node_modules", "dist"] | ||
| "extends": "../../tsconfig.base.json", | ||
| "include": ["*.ts"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "target": "ESNext", | ||
| "module": "ESNext", | ||
| "moduleResolution": "bundler", | ||
| "esModuleInterop": true, | ||
| "skipLibCheck": true, | ||
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "noEmit": true, | ||
| "strict": true, | ||
| "noUnusedLocals": true, | ||
| "noUnusedParameters": true, | ||
| "noFallthroughCasesInSwitch": true | ||
| }, | ||
| "exclude": ["node_modules", "dist"] | ||
| } |
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.
Root
prettierwas changed to a caret range (^3.7.4), which is already resolving to3.8.1inyarn.lock. Since formatting consistency is the goal of this PR (and@clickhouse/click-uipreviously pinned Prettier), consider pinning Prettier to an exact version (or adding a Yarn resolution) to avoid formatting diffs when new minor versions are released.