Skip to content

Commit b6f36e2

Browse files
authored
add vscode settings, update linters (#567)
1 parent f4daae3 commit b6f36e2

20 files changed

+98
-64
lines changed

.eslintignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
build
2-
dist
32
coverage
4-
.eslintrc.js
5-
lint-staged.config.js
3+
dist
4+
node_modules
5+
storybook-static

.eslintrc.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,9 @@ module.exports = {
8181
format: ["camelCase", "PascalCase"],
8282
leadingUnderscore: "forbid",
8383
},
84-
{
85-
selector: ["objectLiteralProperty", "objectLiteralMethod"],
86-
format: ["camelCase", "PascalCase", "snake_case", "UPPER_CASE"],
87-
leadingUnderscore: "allowDouble",
88-
filter: {
89-
regex: "^(&:)|^[0-9]+$",
90-
match: false,
91-
},
92-
},
9384
{
9485
selector: ["typeProperty"],
95-
format: ["camelCase", "snake_case"],
86+
format: ["camelCase"],
9687
leadingUnderscore: "allowDouble",
9788
filter: {
9889
regex: "^(Component)$",

.github/workflows/reviewdog.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
filter_mode: added
3737
level: warning
3838
fail_on_error: false
39-
eslint_flags: '--ignore-path .gitignore .'
39+
eslint_flags: '. --report-unused-disable-directives'
4040

4141
- name: Stylelint
4242
uses: reviewdog/action-stylelint@v1

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ yarn-debug.log*
2828
yarn-error.log*
2929

3030
storybook-static
31-
.vscode/*

.prettierignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
build
2+
coverage
23
dist
4+
node_modules
35
storybook-static
46
tsconfig.json
5-
coverage
6-
.vscode

.stylelintignore

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
src/generated
2-
public
31
build
2+
coverage
3+
dist
4+
node_modules
5+
storybook-static

.vscode/extensions.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-vscode",
5+
"stylelint.vscode-stylelint"
6+
]
7+
}

.vscode/settings.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"editor.codeActionsOnSave": {
3+
"source.fixAll.eslint": true
4+
},
5+
"eslint.probe": [
6+
"javascript",
7+
"javascriptreact",
8+
"typescript",
9+
"typescriptreact"
10+
],
11+
"editor.defaultFormatter": "esbenp.prettier-vscode",
12+
"editor.formatOnSave": true,
13+
"eslint.rules.customizations": [{ "rule": "*", "severity": "warn" }],
14+
"typescript.tsdk": "node_modules/typescript/lib",
15+
"css.validate": false,
16+
"less.validate": false,
17+
"scss.validate": false,
18+
"stylelint.enable": true
19+
}

nordcloud-gnui-8.0.0.tgz

-547 KB
Binary file not shown.

package-lock.json

+38-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+7-8
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
"test:watch": "npm run test -- --watch",
2727
"test:commit": "npm run test -- -o --silent --watchAll=false",
2828
"test:all": "npm run test -- --silent --watchAll=false",
29-
"format": "prettier --ignore-path .gitignore --write \"**/*.+(js|json|ts|tsx|md|mdx|yml)\"",
29+
"format": "prettier --write \"**/*\" --ignore-unknown",
3030
"check:types": "tsc --pretty",
31-
"check:format": "prettier --check \"**/*.+(js|json|ts|tsx|md|mdx|yml)\"",
32-
"lint": "eslint --ignore-path .gitignore .",
31+
"check:format": "prettier --check \"**/*\" --ignore-unknown",
32+
"lint": "eslint . --report-unused-disable-directives",
3333
"lint:quiet": "npm run lint -- --quiet",
3434
"lint:css": "stylelint '**/*.+(ts|tsx)'",
3535
"lint:css:quiet": "npm run lint:css -- --quiet",
@@ -61,10 +61,9 @@
6161
"*.{ts,tsx,js}": [
6262
"prettier --write",
6363
"eslint --fix",
64-
"stylelint",
65-
"git add"
64+
"stylelint"
6665
],
67-
"*.{md,mdx,css,yaml,yml}": [
66+
"*.{md,mdx,css,yaml,yml,json}": [
6867
"prettier --write"
6968
]
7069
},
@@ -88,7 +87,7 @@
8887
"styled-system": "^5.1.5"
8988
},
9089
"devDependencies": {
91-
"@nordcloud/eslint-config-pat": "^4.15.1",
90+
"@nordcloud/eslint-config-pat": "^4.16.3",
9291
"@rollup/plugin-commonjs": "^24.0.0",
9392
"@rollup/plugin-node-resolve": "^15.0.1",
9493
"@storybook/addon-docs": "^6.5.13",
@@ -114,7 +113,7 @@
114113
"lint-staged": "^10.3.0",
115114
"npm-run-all": "^4.1.5",
116115
"patch-package": "^6.5.0",
117-
"prettier": "^2.8.0",
116+
"prettier": "^2.8.4",
118117
"react": "^17.0.2",
119118
"react-copy-to-clipboard": "^5.1.0",
120119
"react-dom": "^17.0.2",

renovate.json5

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": ["config:base", ":separateMultipleMajorReleases", "schedule:monthly", ":automergeDisabled"],
3+
"extends": [
4+
"config:base",
5+
":separateMultipleMajorReleases",
6+
"schedule:monthly",
7+
":automergeDisabled"
8+
],
49
"enabledManagers": ["npm"],
510
"labels": ["dependencies"],
611
"node": {
@@ -35,10 +40,7 @@
3540
},
3641
{
3742
"groupName": "Styled System",
38-
"matchPackageNames": [
39-
"styled-system",
40-
"@types/styled-system"
41-
]
43+
"matchPackageNames": ["styled-system", "@types/styled-system"]
4244
},
4345
{
4446
"groupName": "Jest",
@@ -61,17 +63,11 @@
6163
},
6264
{
6365
"groupName": "React Helmet",
64-
"matchPackageNames": [
65-
"react-helmet",
66-
"@types/react-helmet"
67-
]
66+
"matchPackageNames": ["react-helmet", "@types/react-helmet"]
6867
},
6968
{
7069
"groupName": "Styled Components",
71-
"matchPackageNames": [
72-
"styled-components",
73-
"@types/styled-components"
74-
]
70+
"matchPackageNames": ["styled-components", "@types/styled-components"]
7571
},
7672
{
7773
"matchDepTypes": ["devDependencies"],

src/components/button/Button.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ const changeSeverity = (severity: string) => {
108108
}
109109
};
110110

111-
/* eslint-disable sonarjs/no-identical-functions */
112111
const StyledButton = styled.button<ButtonProps<React.ElementType>>`
113112
background: ${theme.color.interactive.primary};
114113
white-space: nowrap;

src/components/container/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ const lengthUnitSuffix = {
2727
...relativeLengthUnitSuffix,
2828
};
2929
export type LengthUnitSuffix =
30-
typeof lengthUnitSuffix[keyof typeof lengthUnitSuffix];
30+
(typeof lengthUnitSuffix)[keyof typeof lengthUnitSuffix];
3131

3232
const unitSuffix = {
3333
...lengthUnitSuffix,
3434
...multiplicationUnitSuffix,
3535
};
36-
type UnitSuffix = typeof unitSuffix[keyof typeof unitSuffix];
36+
type UnitSuffix = (typeof unitSuffix)[keyof typeof unitSuffix];
3737

3838
export type Unit<Suffix extends UnitSuffix> = `${number}${Suffix}`;

src/components/input/styles.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ export const setStatusColor = (status: Status) => {
99
return css`
1010
border: 1px solid ${theme.color.border.error};
1111
`;
12-
} else if (status === "success") {
12+
}
13+
14+
if (status === "success") {
1315
return css`
1416
border: 1px solid ${theme.color.border.input};
1517
`;
1618
}
1719
};
1820

19-
/* eslint-disable sonarjs/no-identical-functions */
2021
export const InputGroup = styled(FlexContainer)<
2122
SpaceProps & StyledInputGroupProps
2223
>`

src/components/select/Select.stories.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ return (
126126
In TypeScript, Ref needs to be properly typed:
127127

128128
```tsx
129-
const selectRef = React.useRef<SelectInstance<typeof options[number]> | null>(
129+
const selectRef = React.useRef<SelectInstance<(typeof options)[number]> | null>(
130130
null
131131
);
132132
```

src/components/select/Select.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ function getOptionBgColor(
142142
}
143143

144144
/* taken from https://github.com/JedWatson/react-select/blob/master/docs/examples/StyledMulti.tsx */
145-
/* eslint-disable no-nested-ternary */
146145
export const customMultiColorStyles: StylesConfig<SelectColoredOption, true> = {
147146
...getDefaultStyles(),
148147
control: (styles) => ({ ...styles, backgroundColor: "white" }),

src/components/table/Table.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export type StyledTableProps = {
1010
};
1111

1212
/* stylelint-disable no-descending-specificity */
13-
/* eslint-disable sonarjs/no-identical-functions */
1413
const StyledTable = styled.table<StyledTableProps>`
1514
width: 100%;
1615
text-align: left;

src/hooks/useClickOutside.ts

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { off, on } from "../utils/listeners";
33

44
const defaultEvents = ["mousedown", "touchstart"];
55

6-
/* eslint-disable max-params */
76
export const useClickOutside = <E extends Event = Event>({
87
ref,
98
active = true,

src/utils/flattenChildren/flattenChildren.spec.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable @typescript-eslint/consistent-type-definitions, @typescript-eslint/no-namespace, jest/prefer-strict-equal, @typescript-eslint/no-explicit-any, jsx-a11y/anchor-is-valid, jsx-a11y/anchor-has-content */
1+
/* eslint-disable @typescript-eslint/consistent-type-definitions, @typescript-eslint/no-namespace, jest/prefer-strict-equal, jsx-a11y/anchor-is-valid, jsx-a11y/anchor-has-content */
22
// Code from https://github.com/gregberge/react-flatten-children
33
import * as React from "react";
44
import { flattenChildren } from "./flattenChildren";

0 commit comments

Comments
 (0)