Skip to content

Commit 13659d0

Browse files
authored
ci: Ensure that eslint runs on all frontend code (no-changelog) (#4602)
* ensure that eslint runs on all frontend code * remove tslint from `design-system` * enable prettier and eslint-prettier for `design-system` * Delete tslint.json * use a single editorconfig for the repo * enable prettier for all code in `design-system` * more linting fixes on design-system * ignore coverage for git and prettier * lintfix on editor-ui
1 parent d96d6f1 commit 13659d0

File tree

227 files changed

+2214
-2558
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+2214
-2558
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ indent_size = 2
1515
[*.yml]
1616
indent_style = space
1717
indent_size = 2
18+
19+
[*.ts]
20+
quote_type = single

.prettierignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
dist
22
packages/editor-ui
3-
packages/design-system
4-
package*.json
3+
package.json
54

65
!packages/nodes-base/src
76
!packages/nodes-base/test

packages/@n8n_io/eslint-config/base.js

-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ const config = (module.exports = {
99
},
1010

1111
ignorePatterns: [
12-
'.eslintrc.js', // TODO: remove this
1312
'node_modules/**',
1413
'dist/**',
1514
'test/**', // TODO: remove this
16-
'jest.config.js', // TODO: remove this
1715
],
1816

1917
plugins: [

packages/@n8n_io/eslint-config/frontend.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ module.exports = {
1414

1515
parser: 'vue-eslint-parser',
1616
parserOptions: {
17-
parser: '@typescript-eslint/parser',
17+
parser: {
18+
ts: '@typescript-eslint/parser',
19+
js: '@typescript-eslint/parser',
20+
vue: 'vue-eslint-parser',
21+
template: 'vue-eslint-parser',
22+
},
1823
},
1924

20-
ignorePatterns: ['**/*.js', '**/*.d.ts', 'vite.config.ts'],
25+
ignorePatterns: ['**/*.js', '**/*.d.ts', 'vite.config.ts', '**/*.ts.snap'],
2126

2227
rules: {
2328
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',

packages/design-system/.editorconfig

-15
This file was deleted.

packages/design-system/.eslintrc.js

+40-13
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,50 @@ module.exports = {
66

77
parserOptions: {
88
project: ['./tsconfig.json'],
9+
tsconfigRootDir: __dirname,
10+
extraFileExtensions: ['.vue'],
911
},
1012

1113
rules: {
1214
// TODO: Remove these
1315
'import/no-default-export': 'off',
14-
'import/no-extraneous-dependencies': 'off',
1516
'import/order': 'off',
16-
'prettier/prettier': 'off',
17-
'@typescript-eslint/member-delimiter-style': 'off',
18-
'@typescript-eslint/naming-convention': 'off',
19-
'@typescript-eslint/no-explicit-any': 'off',
20-
'@typescript-eslint/no-unsafe-argument': 'off',
21-
'@typescript-eslint/no-unsafe-return': 'off',
22-
'@typescript-eslint/no-unused-vars': 'off',
23-
'@typescript-eslint/prefer-nullish-coalescing': 'off',
24-
'@typescript-eslint/prefer-optional-chain': 'off',
25-
'@typescript-eslint/restrict-template-expressions': 'off',
26-
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
27-
}
17+
'@typescript-eslint/no-explicit-any': 'warn',
18+
'@typescript-eslint/no-unsafe-argument': 'warn',
19+
'@typescript-eslint/no-unsafe-return': 'warn',
20+
'@typescript-eslint/no-unsafe-member-access': 'warn',
21+
},
22+
23+
overrides: [
24+
{
25+
files: ['src/**/*.stories.{js,ts}'],
26+
rules: {
27+
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
28+
},
29+
},
30+
{
31+
files: ['src/**/*.stories.{js,ts}', 'src/**/*.vue', 'src/**/*.spec.ts'],
32+
rules: {
33+
'@typescript-eslint/naming-convention': [
34+
'warn',
35+
{
36+
selector: ['variable', 'property'],
37+
format: ['PascalCase', 'camelCase', 'UPPER_CASE'],
38+
},
39+
],
40+
},
41+
},
42+
{
43+
files: ['src/components/N8nFormInput/validators.ts'],
44+
rules: {
45+
'@typescript-eslint/naming-convention': [
46+
'error',
47+
{
48+
selector: ['property'],
49+
format: ['camelCase', 'UPPER_CASE'],
50+
},
51+
],
52+
},
53+
},
54+
],
2855
};

packages/design-system/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
coverage
12
storybook-static
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage
2+
dist
3+
package.json

packages/design-system/.storybook/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module.exports = {
1414
postcssLoaderOptions: {
1515
implementation: require('postcss'),
1616
},
17-
}
17+
},
1818
},
1919
'storybook-addon-designs',
2020
'storybook-addon-themes',

packages/design-system/.storybook/storybook.scss

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
@use "./fonts.scss";
1+
@use './fonts.scss';
22

3-
@use "~/src/css/base.scss" with (
4-
$font-path: '~element-ui/lib/theme-chalk/fonts',
3+
@use '~/src/css/base.scss' with (
4+
$font-path: '~element-ui/lib/theme-chalk/fonts'
55
);
66

7-
@use "~/src/css/reset.scss";
8-
@use "~/src/css/index.scss";
7+
@use '~/src/css/reset.scss';
8+
@use '~/src/css/index.scss';
99

1010
.multi-container > * {
1111
margin-bottom: 10px;

packages/design-system/package.json

+14-12
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,22 @@
2121
"test:dev": "vitest",
2222
"build:storybook": "build-storybook",
2323
"storybook": "start-storybook -p 6006",
24-
"format": "prettier **/**.{ts,vue} --write",
25-
"lint": "tslint -p tsconfig.json -c tslint.json && eslint .",
26-
"lintfix": "tslint --fix -p tsconfig.json -c tslint.json && eslint . --fix"
24+
"format": "prettier **/**.{js,ts,vue,css,scss,mdx,html} --write .",
25+
"lint": "eslint --ext .js,.ts,.vue src",
26+
"lintfix": "eslint --ext .js,.ts,.vue src --fix"
2727
},
2828
"peerDependencies": {
2929
"@fortawesome/fontawesome-svg-core": "1.x",
3030
"@fortawesome/free-solid-svg-icons": "5.x",
3131
"@fortawesome/vue-fontawesome": "2.x",
32-
"core-js": "3.x"
32+
"core-js": "3.x",
33+
"markdown-it": "^12.3.2",
34+
"markdown-it-emoji": "^2.0.0",
35+
"markdown-it-link-attributes": "^4.0.0",
36+
"markdown-it-task-lists": "^2.1.1",
37+
"vue": "^2.7",
38+
"vue-typed-mixins": "^0.2.0",
39+
"xss": "^1.0.10"
3340
},
3441
"devDependencies": {
3542
"@fortawesome/fontawesome-svg-core": "^1.2.35",
@@ -43,14 +50,12 @@
4350
"@testing-library/jest-dom": "^5.16.4",
4451
"@testing-library/vue": "^5.8.3",
4552
"@types/markdown-it": "^12.2.3",
53+
"@types/markdown-it-emoji": "^2.0.2",
54+
"@types/markdown-it-link-attributes": "^3.0.1",
4655
"@types/sanitize-html": "^2.6.2",
4756
"c8": "7.11.0",
4857
"core-js": "^3.6.5",
4958
"jsdom": "19.0.0",
50-
"markdown-it": "^12.3.2",
51-
"markdown-it-emoji": "^2.0.0",
52-
"markdown-it-link-attributes": "^4.0.0",
53-
"markdown-it-task-lists": "^2.1.1",
5459
"node-notifier": ">=8.0.1",
5560
"sass": "^1.55.0",
5661
"sass-loader": "^10.1.1",
@@ -60,16 +65,13 @@
6065
"vite": "^2.9.5",
6166
"@vitejs/plugin-vue2": "^1.1.2",
6267
"vitest": "^0.9.3",
63-
"vue": "^2.7",
6468
"vue-class-component": "^7.2.3",
6569
"vue-loader": "^15.9.7",
6670
"vue-property-decorator": "^9.1.2",
6771
"vue-template-compiler": "^2.7",
6872
"vue-tsc": "^0.34.8",
69-
"vue-typed-mixins": "^0.2.0",
7073
"vue2-boring-avatars": "0.3.4",
71-
"webpack": "^4.46.0",
72-
"xss": "^1.0.10"
74+
"webpack": "^4.46.0"
7375
},
7476
"dependencies": {
7577
"element-ui": "~2.15.7",

packages/design-system/src/components/N8nActionBox/ActionBox.stories.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
/* tslint:disable:variable-name */
2-
31
import N8nActionBox from './ActionBox.vue';
42
import { action } from '@storybook/addon-actions';
5-
import {StoryFn} from "@storybook/vue";
3+
import type { StoryFn } from '@storybook/vue';
64

75
export default {
86
title: 'Atoms/ActionBox',
@@ -35,8 +33,9 @@ const Template: StoryFn = (args, { argTypes }) => ({
3533

3634
export const ActionBox = Template.bind({});
3735
ActionBox.args = {
38-
emoji: "😿",
39-
heading: "Headline you need to know",
40-
description: "Long description that you should know something is the way it is because of how it is. ",
41-
buttonText: "Do something",
36+
emoji: '😿',
37+
heading: 'Headline you need to know',
38+
description:
39+
'Long description that you should know something is the way it is because of how it is. ',
40+
buttonText: 'Do something',
4241
};

packages/design-system/src/components/N8nActionBox/ActionBox.vue

-1
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,4 @@ export default Vue.extend({
118118
width: 100%;
119119
text-align: left;
120120
}
121-
122121
</style>

packages/design-system/src/components/N8nActionBox/__tests__/ActionBox.spec.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
import {render} from '@testing-library/vue';
1+
import { render } from '@testing-library/vue';
22
import N8NActionBox from '../ActionBox.vue';
33

44
describe('N8NActionBox', () => {
55
it('should render correctly', () => {
66
const wrapper = render(N8NActionBox, {
77
props: {
8-
emoji: "😿",
9-
heading: "Headline you need to know",
10-
description: "Long description that you should know something is the way it is because of how it is. ",
11-
buttonText: "Do something",
8+
emoji: '😿',
9+
heading: 'Headline you need to know',
10+
description:
11+
'Long description that you should know something is the way it is because of how it is. ',
12+
buttonText: 'Do something',
1213
},
13-
stubs: [
14-
'n8n-heading',
15-
'n8n-text',
16-
'n8n-button',
17-
'n8n-callout',
18-
],
14+
stubs: ['n8n-heading', 'n8n-text', 'n8n-button', 'n8n-callout'],
1915
});
2016
expect(wrapper.html()).toMatchSnapshot();
2117
});

packages/design-system/src/components/N8nActionDropdown/ActionDropdown.stories.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import N8nActionDropdown from "./ActionDropdown.vue";
2-
import { StoryFn } from '@storybook/vue';
1+
import N8nActionDropdown from './ActionDropdown.vue';
2+
import type { StoryFn } from '@storybook/vue';
33

44
export default {
55
title: 'Atoms/ActionDropdown',

0 commit comments

Comments
 (0)