Skip to content

Commit 7474714

Browse files
committed
feat(eslint): eslint v9 and shared configs [KHCP-11627]
1 parent 7140f1d commit 7474714

24 files changed

+673
-1553
lines changed

.eslintignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 0 additions & 59 deletions
This file was deleted.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ lerna-debug.log*
1010
node_modules
1111
.DS_Store
1212
dist
13-
demo/dist-copy
1413
dist-ssr
1514
coverage
1615
*.local

.stylelintrc.cjs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,38 @@ module.exports = {
22
extends: [
33
'stylelint-config-html',
44
'stylelint-config-recommended-scss',
5-
'stylelint-config-recommended-vue/scss'
5+
'stylelint-config-recommended-vue/scss',
66
],
77
overrides: [
88
{
99
files: [
1010
'**/*.vue',
11-
'**/*.scss'
11+
'**/*.scss',
1212
],
1313
rules: {
1414
'unit-disallowed-list': [
1515
['rem', 'em'],
1616
],
1717
// Only allow @kong/design-tokens CSS custom properties
1818
'custom-property-pattern': [
19-
"^(kui).+$",
19+
'^(kui).+$',
2020
{
2121
message: "Expected custom property \"%s\" to be sourced from @kong/design-tokens with prefix '--kui-'",
22-
}
22+
},
2323
],
2424
'custom-property-no-missing-var-function': true,
2525
// Disable the following rules
2626
'no-descending-specificity': null,
27-
'scss/at-import-no-partial-leading-underscore': null
28-
}
29-
}
27+
'scss/at-import-no-partial-leading-underscore': null,
28+
},
29+
},
3030
],
3131
plugins: [
3232
'stylelint-order',
33-
'@kong/design-tokens/stylelint-plugin'
33+
'@kong/design-tokens/stylelint-plugin',
3434
],
3535
rules: {
3636
'order/properties-alphabetical-order': true,
37-
'@kong/design-tokens/use-proper-token': [true, {disableFix: true}]
38-
}
37+
'@kong/design-tokens/use-proper-token': [true, { disableFix: true }],
38+
},
3939
}

eslint.config.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import eslintKongUiConfig from '@kong/eslint-config-kong-ui'
2+
import eslintKongUiConfigCypress from '@kong/eslint-config-kong-ui/cypress'
3+
4+
export default [
5+
...eslintKongUiConfig,
6+
// Only apply the shared Cypress config to files that match the given pattern
7+
...eslintKongUiConfigCypress.map(config => ({
8+
...config,
9+
files: [
10+
'**/*.spec.ts',
11+
'**/cypress/**',
12+
],
13+
})),
14+
]

package.json

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"dev:components": "cross-env SANDBOX=components vite",
1818
"dev:elements": "cross-env SANDBOX=elements vite",
1919
"typecheck": "vue-tsc --noEmit",
20-
"lint": "eslint '**/*.{js,ts,vue}'",
21-
"lint:fix": "yarn lint --fix",
20+
"lint": "eslint",
21+
"lint:fix": "eslint --fix",
2222
"stylelint": "stylelint './src/**/*.{css,scss,sass,vue}'",
2323
"stylelint:fix": "yarn stylelint --fix",
2424
"test": "cypress run --component -b chrome",
@@ -51,28 +51,18 @@
5151
"@digitalroute/cz-conventional-changelog-for-jira": "^8.0.1",
5252
"@evilmartians/lefthook": "^1.6.12",
5353
"@kong/design-tokens": "^1.12.12",
54+
"@kong/eslint-config-kong-ui": "^1.0.3",
5455
"@kong/kongponents": "9.0.0-alpha.159",
55-
"@rushstack/eslint-patch": "^1.10.3",
5656
"@semantic-release/changelog": "^6.0.3",
5757
"@semantic-release/git": "^10.0.1",
5858
"@types/node": "^18.19.33",
59-
"@typescript-eslint/eslint-plugin": "^7.9.0",
60-
"@typescript-eslint/parser": "^7.9.0",
6159
"@vitejs/plugin-vue": "^5.0.4",
62-
"@vue/eslint-config-standard": "^8.0.1",
63-
"@vue/eslint-config-typescript": "^12.0.0",
6460
"@vue/tsconfig": "^0.5.1",
6561
"commitizen": "^4.3.0",
6662
"cross-env": "^7.0.3",
6763
"cypress": "^13.9.0",
6864
"cz-conventional-changelog": "3.3.0",
69-
"eslint": "^8.57.0",
70-
"eslint-plugin-cypress": "^3.2.0",
71-
"eslint-plugin-import": "^2.29.1",
72-
"eslint-plugin-node": "^11.1.0",
73-
"eslint-plugin-promise": "^6.1.1",
74-
"eslint-plugin-standard": "^5.0.0",
75-
"eslint-plugin-vue": "^9.26.0",
65+
"eslint": "^9.4.0",
7666
"postcss-custom-properties": "^13.3.10",
7767
"postcss-html": "^1.7.0",
7868
"rollup-plugin-visualizer": "^5.12.0",

sandbox/components/ComponentsApp.vue

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<template>
22
<SharedLayout type="components">
3-
<div v-if="route.name === 'login'" class="element-wrapper">
3+
<div
4+
v-if="route.name === 'login'"
5+
class="element-wrapper"
6+
>
47
<h4>
58
<code>KongAuthLogin.vue</code>
69
</h4>
@@ -17,7 +20,10 @@
1720
/>
1821
</div>
1922

20-
<div v-if="route.name === 'forgot-password'" class="element-wrapper">
23+
<div
24+
v-if="route.name === 'forgot-password'"
25+
class="element-wrapper"
26+
>
2127
<h4>
2228
<code>KongAuthForgotPassword.vue</code>
2329
</h4>
@@ -29,7 +35,10 @@
2935
/>
3036
</div>
3137

32-
<div v-if="route.name === 'reset-password'" class="element-wrapper">
38+
<div
39+
v-if="route.name === 'reset-password'"
40+
class="element-wrapper"
41+
>
3342
<h4>
3443
<code>KongAuthResetPassword.vue</code>
3544
</h4>
@@ -40,7 +49,10 @@
4049
/>
4150
</div>
4251

43-
<div v-if="route.name === 'change-password'" class="element-wrapper">
52+
<div
53+
v-if="route.name === 'change-password'"
54+
class="element-wrapper"
55+
>
4456
<h4>
4557
<code>KongAuthChangePassword.vue</code>
4658
</h4>
@@ -52,25 +64,33 @@
5264
/>
5365
</div>
5466

55-
<div v-if="route.name === 'register'" class="element-wrapper">
67+
<div
68+
v-if="route.name === 'register'"
69+
class="element-wrapper"
70+
>
5671
<h4>
5772
<code>KongAuthRegister.vue</code>
5873
</h4>
5974
<KongAuthRegister
6075
access-code-required
6176
recaptcha
6277
wrapper-id="kong-auth-register-wrapper"
63-
@register-success="showAlert('Register success!')" />
78+
@register-success="showAlert('Register success!')"
79+
/>
6480
</div>
6581

66-
<div v-if="route.name === 'accept-invitation'" class="element-wrapper">
82+
<div
83+
v-if="route.name === 'accept-invitation'"
84+
class="element-wrapper"
85+
>
6786
<h4>
6887
<code>KongAuthAcceptInvitation.vue</code>
6988
</h4>
7089
<KongAuthAcceptInvitation
7190
subheader-text="This is custom text"
7291
wrapper-id="kong-auth-accept-invitation-wrapper"
73-
@accept-invitation-success="showAlert('Accept invitation success!')" />
92+
@accept-invitation-success="showAlert('Accept invitation success!')"
93+
/>
7494
</div>
7595
</SharedLayout>
7696
</template>

sandbox/elements/ElementsApp.vue

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<template>
22
<SharedLayout type="elements">
3-
<div v-if="route.name === 'login'" class="element-wrapper">
3+
<div
4+
v-if="route.name === 'login'"
5+
class="element-wrapper"
6+
>
47
<h4>
58
<code>kong-auth-login</code>
69
</h4>
@@ -21,7 +24,10 @@
2124
</div>
2225
</div>
2326

24-
<div v-if="route.name === 'forgot-password'" class="element-wrapper">
27+
<div
28+
v-if="route.name === 'forgot-password'"
29+
class="element-wrapper"
30+
>
2531
<h4>
2632
<code>kong-auth-forgot-password</code>
2733
</h4>
@@ -36,7 +42,10 @@
3642
</div>
3743
</div>
3844

39-
<div v-if="route.name === 'reset-password'" class="element-wrapper">
45+
<div
46+
v-if="route.name === 'reset-password'"
47+
class="element-wrapper"
48+
>
4049
<h4>
4150
<code>kong-auth-reset-password</code>
4251
</h4>
@@ -49,7 +58,10 @@
4958
</div>
5059
</div>
5160

52-
<div v-if="route.name === 'change-password'" class="element-wrapper">
61+
<div
62+
v-if="route.name === 'change-password'"
63+
class="element-wrapper"
64+
>
5365
<h4>
5466
<code>kong-auth-change-password</code>
5567
</h4>
@@ -63,26 +75,34 @@
6375
</div>
6476
</div>
6577

66-
<div v-if="route.name === 'register'" class="element-wrapper">
78+
<div
79+
v-if="route.name === 'register'"
80+
class="element-wrapper"
81+
>
6782
<h4>
6883
<code>KongAuthRegister.vue</code>
6984
</h4>
7085
<div id="kong-auth-register-wrapper">
7186
<kong-auth-register
7287
access-code-required
7388
wrapper-id="kong-auth-register-wrapper"
74-
@register-success="showAlert('Register success!')" />
89+
@register-success="showAlert('Register success!')"
90+
/>
7591
</div>
7692
</div>
7793

78-
<div v-if="route.name === 'accept-invitation'" class="element-wrapper">
94+
<div
95+
v-if="route.name === 'accept-invitation'"
96+
class="element-wrapper"
97+
>
7998
<h4>
8099
<code>KongAuthAcceptInvitation.vue</code>
81100
</h4>
82101
<div id="kong-auth-accept-invitation-wrapper">
83102
<kong-auth-accept-invitation
84103
wrapper-id="kong-auth-accept-invitation-wrapper"
85-
@accept-invitation-success="showAlert('Accept invitation success!')" />
104+
@accept-invitation-success="showAlert('Accept invitation success!')"
105+
/>
86106
</div>
87107
</div>
88108
</SharedLayout>

sandbox/shared/AppNav.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<template>
22
<nav class="app-nav">
33
<ul>
4-
<li v-for="routeName in routes" :key="routeName">
4+
<li
5+
v-for="routeName in routes"
6+
:key="routeName"
7+
>
58
<router-link :to="{ name: routeName }">
69
<span>{{ routeName }}</span>
710
<span v-if="route.name === routeName">&rsaquo;</span>

0 commit comments

Comments
 (0)