-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from clickbar/06-26-feat_eslint-v9_migrate_to…
…_flat-config_eslint_v9
- Loading branch information
Showing
18 changed files
with
965 additions
and
1,880 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
'@clickbar/eslint-config-typescript': major | ||
'@clickbar/eslint-config-base': major | ||
'@clickbar/eslint-config': major | ||
'@clickbar/eslint-config-vue': major | ||
--- | ||
|
||
Migrate to Eslint v9 & flat-config | ||
|
||
Please use an `eslint.config.js` file and use our rules like this: | ||
|
||
```js | ||
import clickbar from '@clickbar/eslint-config' | ||
|
||
export default clickbar() | ||
``` | ||
|
||
For other necessary adjustments please checkout the ESlint config documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@clickbar/eslint-config-base': major | ||
--- | ||
|
||
Switch to import-x eslint plugin | ||
|
||
Note: You might need to rename references for `import/....` rules to `import-x/....` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@clickbar/eslint-config-base': major | ||
--- | ||
|
||
Remove eslint-plugin-html & eslint-plugin-eslint-comments |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import clickbar from './packages/all/index.js' | ||
|
||
export default clickbar() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,23 +2,26 @@ | |
"name": "@clickbar/eslint-config-monorepo", | ||
"packageManager": "[email protected]", | ||
"private": true, | ||
"type": "module", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"fix": "pnpm lint --fix && pnpm format", | ||
"format": "pnpm prettier --write", | ||
"lint": "eslint .", | ||
"prettier": "prettier . --cache", | ||
"dev": "npx @eslint/config-inspector --config eslint.config.js", | ||
"test": "pnpm lint && pnpm prettier --check" | ||
}, | ||
"description": "eslint config used at clickbar.", | ||
"repository": "https://github.com/clickbar/eslint-config.git", | ||
"author": "Alexander von Studnitz <[email protected]>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@changesets/cli": "^2.27.5", | ||
"@changesets/cli": "^2.27.6", | ||
"@clickbar/eslint-config": "workspace:*", | ||
"eslint": "^8.57.0", | ||
"prettier": "3.3.1", | ||
"typescript": "^5.4.5" | ||
"eslint": "^9.5.0", | ||
"globals": "^15.6.0", | ||
"prettier": "3.3.2", | ||
"typescript": "^5.5.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
module.exports = { | ||
extends: ['@clickbar/eslint-config-vue'], | ||
import vue from '@clickbar/eslint-config-vue' | ||
|
||
export default function clickbar() { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
return vue() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,9 @@ | |
"repository": "https://github.com/clickbar/eslint-config.git", | ||
"author": "Alexander von Studnitz <[email protected]>", | ||
"license": "MIT", | ||
"type": "module", | ||
"peerDependencies": { | ||
"eslint": ">=8.56.0", | ||
"eslint": ">=9.3.0", | ||
"typescript": ">=4.7.4" | ||
}, | ||
"publishConfig": { | ||
|
@@ -19,7 +20,7 @@ | |
"@clickbar/eslint-config-vue": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^8.57.0", | ||
"eslint": "^9.5.0", | ||
"typescript": "~5.4.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,149 @@ | ||
module.exports = { | ||
env: { | ||
es6: true, | ||
browser: true, | ||
node: true, | ||
}, | ||
reportUnusedDisableDirectives: true, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:unicorn/recommended', | ||
'plugin:import/recommended', | ||
'prettier', | ||
], | ||
ignorePatterns: [ | ||
'*.min.*', | ||
'*.d.ts', | ||
'CHANGELOG.md', | ||
'dist', | ||
'LICENSE*', | ||
'public', | ||
'storage', | ||
'vendor', | ||
'composer.json', | ||
'composer.lock', | ||
'package-lock.json', | ||
'pnpm-lock.yaml', | ||
'yarn.lock', | ||
], | ||
plugins: ['html', 'unused-imports'], | ||
settings: { | ||
'import/resolver': { | ||
node: { extensions: ['.js', '.mjs', '.ts', '.d.ts'] }, | ||
import js from '@eslint/js' | ||
import * as pluginImport from 'eslint-plugin-import-x' | ||
import { default as pluginUnicorn } from 'eslint-plugin-unicorn' | ||
import { default as pluginUnusedImports } from 'eslint-plugin-unused-imports' | ||
import globals from 'globals' | ||
|
||
export default function base() { | ||
return [ | ||
{ | ||
name: 'clickbar/ignore', | ||
ignores: [ | ||
'**/node_modules', | ||
'**/dist', | ||
'**/package-lock.json', | ||
'**/yarn.lock', | ||
'**/pnpm-lock.yaml', | ||
'**/bun.lockb', | ||
|
||
'**/output', | ||
'**/coverage', | ||
'**/temp', | ||
'**/.temp', | ||
'**/tmp', | ||
'**/.tmp', | ||
'**/.history', | ||
'**/.vitepress/cache', | ||
'**/.nuxt', | ||
'**/.next', | ||
'**/.vercel', | ||
'**/.changeset', | ||
'**/.idea', | ||
'**/.cache', | ||
'**/.output', | ||
'**/.vite-inspect', | ||
'**/.yarn', | ||
|
||
'**/CHANGELOG*.md', | ||
'**/*.min.*', | ||
'**/LICENSE*', | ||
'**/__snapshots__', | ||
'**/auto-import?(s).d.ts', | ||
'**/components.d.ts', | ||
|
||
'**/composer.json', | ||
'**/composer.lock', | ||
'**/storage', | ||
'**/public', | ||
'**/vendor', | ||
], | ||
}, | ||
'import/internal-regex': '^(@/)', // allow imports beginning with @/ | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.d.ts'], | ||
rules: { | ||
'import/no-duplicates': 'off', | ||
}, | ||
name: 'eslint/js/recommended', | ||
...js.configs.recommended, | ||
}, | ||
], | ||
rules: { | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: [ | ||
['builtin', 'external'], | ||
['internal', 'parent', 'sibling', 'index'], | ||
['object'], | ||
['type'], | ||
], | ||
'newlines-between': 'always', | ||
alphabetize: { | ||
order: 'asc', | ||
caseInsensitive: true, | ||
{ | ||
name: 'clickbar/base', | ||
languageOptions: { | ||
ecmaVersion: 2022, | ||
globals: { | ||
...globals.browser, | ||
...globals.es2021, | ||
...globals.node, | ||
document: 'readonly', | ||
navigator: 'readonly', | ||
window: 'readonly', | ||
}, | ||
warnOnUnassignedImports: true, | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
ecmaVersion: 2022, | ||
sourceType: 'module', | ||
}, | ||
sourceType: 'module', | ||
}, | ||
], | ||
'import/first': 'error', | ||
'import/no-mutable-exports': 'error', | ||
'import/no-unresolved': 'off', | ||
'import/no-absolute-path': 'off', | ||
|
||
'unused-imports/no-unused-imports': 'error', | ||
'unused-imports/no-unused-vars': [ | ||
'warn', | ||
{ | ||
vars: 'all', | ||
varsIgnorePattern: '^_', | ||
args: 'after-used', | ||
argsIgnorePattern: '^_', | ||
linterOptions: { | ||
reportUnusedDisableDirectives: 'warn', | ||
}, | ||
], | ||
plugins: { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
unicorn: pluginUnicorn, | ||
'import-x': pluginImport, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
'unused-imports': pluginUnusedImports, | ||
}, | ||
settings: { | ||
'import-x/internal-regex': '^(@/)', // allow imports beginning with @/ | ||
}, | ||
rules: { | ||
'import-x/order': [ | ||
'error', | ||
{ | ||
groups: [ | ||
['builtin', 'external'], | ||
['internal', 'parent', 'sibling', 'index'], | ||
['object'], | ||
['type'], | ||
], | ||
'newlines-between': 'always', | ||
alphabetize: { | ||
order: 'asc', | ||
caseInsensitive: true, | ||
}, | ||
warnOnUnassignedImports: true, | ||
}, | ||
], | ||
'import-x/first': 'error', | ||
'import-x/no-mutable-exports': 'error', | ||
'import-x/no-unresolved': 'off', | ||
'import-x/no-absolute-path': 'off', | ||
|
||
'unicorn/prevent-abbreviations': [ | ||
'error', | ||
{ replacements: { props: false, ref: false, attrs: false } }, | ||
], | ||
'unicorn/filename-case': [ | ||
'error', | ||
{ cases: { kebabCase: true, pascalCase: true, camelCase: true } }, | ||
], | ||
'unicorn/no-null': 'off', | ||
'unicorn/no-useless-undefined': 'off', | ||
'unicorn/prefer-module': 'off', | ||
'unused-imports/no-unused-imports': 'error', | ||
'unused-imports/no-unused-vars': [ | ||
'warn', | ||
{ | ||
vars: 'all', | ||
varsIgnorePattern: '^_', | ||
args: 'after-used', | ||
argsIgnorePattern: '^_', | ||
}, | ||
], | ||
|
||
'no-console': ['warn', { allow: ['warn', 'error'] }], | ||
'no-debugger': 'warn', | ||
'no-var': 'error', | ||
'object-shorthand': ['error', 'always'], | ||
'prefer-const': 'error', | ||
}, | ||
'unicorn/prevent-abbreviations': [ | ||
'error', | ||
{ replacements: { props: false, ref: false, attrs: false } }, | ||
], | ||
'unicorn/filename-case': [ | ||
'error', | ||
{ cases: { kebabCase: true, pascalCase: true, camelCase: true } }, | ||
], | ||
'unicorn/no-null': 'off', | ||
'unicorn/no-useless-undefined': 'off', | ||
'unicorn/prefer-module': 'off', | ||
|
||
// Prevent clashes with prettier formatting | ||
'unicorn/template-indent': 'off', | ||
'unicorn/empty-brace-spaces': 'off', | ||
'unicorn/no-nested-ternary': 'off', | ||
'unicorn/number-literal-case': 'off', | ||
|
||
'no-console': ['warn', { allow: ['warn', 'error'] }], | ||
'no-debugger': 'warn', | ||
'no-var': 'error', | ||
'object-shorthand': ['error', 'always'], | ||
'prefer-const': 'error', | ||
}, | ||
}, | ||
] | ||
} |
Oops, something went wrong.