Skip to content

Commit 5c2e20b

Browse files
authored
feat(eslint): eslint v9 and shared flat config [KHCP-11627] (#301)
* feat(eslint): eslint v9 and shared flat config [KHCP-11627] * chore: remove comments
1 parent 0b6b393 commit 5c2e20b

File tree

7 files changed

+7002
-24
lines changed

7 files changed

+7002
-24
lines changed

.eslintignore

-7
This file was deleted.

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ jspm_packages
3333
# Optional npm cache directory
3434
.npm
3535

36-
# yarn
37-
yarn.lock
38-
3936
# Optional REPL history
4037
.node_repl_history
4138

eslint.config.mjs

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import eslintKongUiConfig from '@kong/eslint-config-kong-ui'
2+
import eslintKongUiConfigJson from '@kong/eslint-config-kong-ui/json'
3+
4+
export default [
5+
...eslintKongUiConfig,
6+
// Only apply the shared JSON config to files that match the given pattern
7+
...eslintKongUiConfigJson.map(config => ({
8+
...config,
9+
files: ['tokens/**/*.json'],
10+
})),
11+
{
12+
files: [
13+
'**/*.{js,cjs,jsx}',
14+
],
15+
rules: {
16+
'@typescript-eslint/no-var-requires': 'off',
17+
},
18+
},
19+
// Ignore the sort order for the breakpoint tokens so they can be ordered from smallest to largest
20+
{
21+
files: ['tokens/source/breakpoint/**/*.json'],
22+
rules: {
23+
'jsonc/sort-keys': 'off',
24+
},
25+
},
26+
]

package.json

+4-12
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"build:clean": "rimraf ./dist",
88
"copy:tokens-doc": "shx cp -f './dist/tokens/README.md' './TOKENS.md'",
99
"copy:stylelint-plugin": "shx cp -R './stylelint-plugin' './dist/stylelint-plugin/'",
10-
"lint": "eslint '**/*.{js,ts,vue,json}'",
11-
"lint:fix": "eslint '**/*.{js,ts,vue,json}' --fix",
10+
"lint": "eslint",
11+
"lint:fix": "eslint --fix",
1212
"sandbox": "run-p sandbox:open watch:tokens",
1313
"sandbox:open": "vite sandbox -c ./sandbox/vite.config.ts",
1414
"watch:tokens": "yarn build && chokidar \"tokens/**/*.json\" -c \"yarn build\"",
@@ -56,22 +56,14 @@
5656
"@commitlint/config-conventional": "^19.2.2",
5757
"@digitalroute/cz-conventional-changelog-for-jira": "^8.0.1",
5858
"@evilmartians/lefthook": "^1.6.12",
59+
"@kong/eslint-config-kong-ui": "^1.0.3",
5960
"@semantic-release/changelog": "^6.0.3",
6061
"@semantic-release/git": "^10.0.1",
61-
"@typescript-eslint/eslint-plugin": "^7.10.0",
62-
"@typescript-eslint/parser": "^7.10.0",
6362
"@vitejs/plugin-vue": "^5.0.4",
6463
"chokidar-cli": "^3.0.0",
6564
"commitizen": "^4.3.0",
6665
"cz-conventional-changelog": "^3.3.0",
67-
"eslint": "^8.57.0",
68-
"eslint-config-standard": "^17.1.0",
69-
"eslint-plugin-import": "^2.29.1",
70-
"eslint-plugin-jsonc": "^2.16.0",
71-
"eslint-plugin-n": "^17.7.0",
72-
"eslint-plugin-promise": "^6.1.1",
73-
"eslint-plugin-sort-keys-fix": "^1.1.2",
74-
"eslint-plugin-vue": "^9.26.0",
66+
"eslint": "^9.4.0",
7567
"npm-run-all2": "^6.2.0",
7668
"rimraf": "^5.0.7",
7769
"sass": "^1.77.2",

sandbox/components/ColorBlock.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const props = defineProps({
2424
2525
const sanitizedToken = computed((): string => props.token.replace(/^--/, ''))
2626
const swatchStyles = computed((): Record<string, string> => ({
27-
// @ts-ignore
27+
// @ts-ignore: props.token is a valid string
2828
backgroundColor: tokens[props.token],
2929
}))
3030
</script>

sandbox/router.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
1+
import { createRouter, createWebHistory } from 'vue-router'
2+
import type { RouteRecordRaw } from 'vue-router'
23
import HomeView from './pages/HomeView.vue'
34

45
const routes: RouteRecordRaw[] = [

0 commit comments

Comments
 (0)