Skip to content

Commit c445000

Browse files
authored
Update eslint config (#593)
1 parent 4939f31 commit c445000

11 files changed

+391
-201
lines changed

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
!.*
12
build
23
coverage
34
dist

.eslintrc.js

+95-80
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,121 @@
11
require("@nordcloud/eslint-config-pat/patch/modern-module-resolution");
22

3+
/** @type {import("@types/eslint").Linter.Config} */
34
module.exports = {
45
extends: [
56
"@nordcloud/eslint-config-pat/profile/web-app",
67
"@nordcloud/eslint-config-pat/mixins/react",
78
"@nordcloud/eslint-config-pat/mixins/react-testing",
8-
"@nordcloud/eslint-config-pat/mixins/tsdoc",
99
"@nordcloud/eslint-config-pat/mixins/jest",
1010
],
1111

1212
parserOptions: { tsconfigRootDir: __dirname },
1313

14-
ignorePatterns: ["*.js"],
14+
ignorePatterns: ["./*.js"],
1515

1616
settings: {
1717
react: {
18-
version: "16.14.0", // React version. "detect" automatically picks the version you have installed.
18+
version: "17.0.2", // React version. "detect" automatically picks the version you have installed.
1919
},
2020
jest: {
2121
version: "29",
2222
},
2323
},
2424

25-
rules: {
26-
"@typescript-eslint/no-unsafe-return": "warn",
27-
"@typescript-eslint/no-unsafe-argument": "warn",
28-
"@typescript-eslint/no-unsafe-assignment": "warn",
29-
"@typescript-eslint/no-unsafe-member-access": "warn",
30-
// Should be in sync with https://github.com/nordcloud/eslint-config-pat/blob/master/profile/_common.js#L463
31-
"@typescript-eslint/naming-convention": [
32-
"warn",
33-
{
34-
selector: "default",
35-
format: null,
25+
overrides: [
26+
{
27+
files: ["**/*.{js,mjs}"],
28+
parserOptions: {
29+
sourceType: "module",
3630
},
37-
// Ignore destructured names
38-
{
39-
selector: "variable",
40-
types: ["array", "boolean", "function", "number", "string"],
41-
modifiers: ["destructured"],
42-
format: null,
43-
},
44-
{
45-
selector: "variable",
46-
types: ["boolean"],
47-
format: ["PascalCase"],
48-
prefix: [
49-
"is",
50-
"are",
51-
"should",
52-
"has",
53-
"can",
54-
"did",
55-
"will",
56-
"show",
57-
"hide",
31+
},
32+
{
33+
files: ["src/**/*.{ts,tsx}"],
34+
rules: {
35+
"@typescript-eslint/no-unsafe-return": "warn",
36+
"@typescript-eslint/no-unsafe-argument": "warn",
37+
"@typescript-eslint/no-unsafe-assignment": "warn",
38+
"@typescript-eslint/no-unsafe-member-access": "warn",
39+
// Should be in sync with https://github.com/nordcloud/eslint-config-pat/blob/master/profile/_common.js#L463
40+
"@typescript-eslint/naming-convention": [
41+
"warn",
42+
{
43+
selector: "default",
44+
format: null,
45+
},
46+
// Ignore destructured names
47+
{
48+
selector: "variable",
49+
types: ["array", "boolean", "function", "number", "string"],
50+
modifiers: ["destructured"],
51+
format: null,
52+
},
53+
{
54+
selector: "variable",
55+
types: ["boolean"],
56+
format: ["PascalCase"],
57+
prefix: [
58+
"is",
59+
"are",
60+
"should",
61+
"has",
62+
"can",
63+
"did",
64+
"will",
65+
"show",
66+
"hide",
67+
],
68+
},
69+
{
70+
selector: "variable",
71+
format: ["camelCase", "UPPER_CASE", "PascalCase"],
72+
},
73+
{
74+
selector: "parameter",
75+
format: ["camelCase"],
76+
leadingUnderscore: "allow",
77+
filter: {
78+
regex: "^(Component)$",
79+
match: false,
80+
},
81+
},
82+
{
83+
selector: "memberLike",
84+
modifiers: ["private"],
85+
format: ["camelCase"],
86+
leadingUnderscore: "require",
87+
},
88+
{
89+
selector: ["function"],
90+
format: ["camelCase", "PascalCase"],
91+
leadingUnderscore: "forbid",
92+
},
93+
{
94+
selector: ["typeProperty"],
95+
format: ["camelCase"],
96+
leadingUnderscore: "allowDouble",
97+
filter: {
98+
regex: "^(Component)$",
99+
match: false,
100+
},
101+
},
102+
{
103+
selector: ["enumMember"],
104+
format: ["PascalCase", "UPPER_CASE"],
105+
},
106+
{
107+
selector: "enum",
108+
format: ["PascalCase", "UPPER_CASE"],
109+
},
58110
],
59111
},
60-
{
61-
selector: "variable",
62-
format: ["camelCase", "UPPER_CASE", "PascalCase"],
63-
},
64-
{
65-
selector: "parameter",
66-
format: ["camelCase"],
67-
leadingUnderscore: "allow",
68-
filter: {
69-
regex: "^(Component)$",
70-
match: false,
71-
},
72-
},
73-
{
74-
selector: "memberLike",
75-
modifiers: ["private"],
76-
format: ["camelCase"],
77-
leadingUnderscore: "require",
78-
},
79-
{
80-
selector: ["function"],
81-
format: ["camelCase", "PascalCase"],
82-
leadingUnderscore: "forbid",
83-
},
84-
{
85-
selector: ["typeProperty"],
86-
format: ["camelCase"],
87-
leadingUnderscore: "allowDouble",
88-
filter: {
89-
regex: "^(Component)$",
90-
match: false,
91-
},
92-
},
93-
{
94-
selector: ["enumMember"],
95-
format: ["PascalCase", "UPPER_CASE"],
96-
},
97-
{
98-
selector: "enum",
99-
format: ["PascalCase", "UPPER_CASE"],
112+
},
113+
{
114+
files: ["src/**/*.spec.{ts,tsx}"],
115+
rules: {
116+
"testing-library/no-node-access": "warn",
117+
"testing-library/no-container": "warn",
100118
},
101-
],
102-
103-
"testing-library/no-node-access": "warn",
104-
"testing-library/no-container": "warn",
105-
},
119+
},
120+
],
106121
};

.github/workflows/codeql-analysis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
# the `language` matrix defined below to confirm you have the correct set of
1010
# supported CodeQL languages.
1111
#
12-
name: 'CodeQL'
12+
name: CodeQL
1313

1414
on:
1515
push:
16-
branches: ['master']
16+
branches: [master]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: ['master']
19+
branches: [master]
2020
schedule:
2121
- cron: '20 5 * * 2'
2222

@@ -32,7 +32,7 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
language: ['javascript']
35+
language: [javascript]
3636
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3737
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
3838

.github/workflows/dependency-review.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright 2023 Nordcloud Oy or its affiliates. All Rights Reserved.
22

3-
name: 'Dependency Review'
3+
name: Dependency Review
44
on:
55
pull_request:
66
branches: [master]
@@ -12,7 +12,7 @@ jobs:
1212
dependency-review:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: 'Checkout Repository'
15+
- name: Checkout Repository
1616
uses: actions/checkout@v3
1717
- name: Dependency Review
1818
uses: actions/dependency-review-action@v3

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
- uses: actions/checkout@v2
1010
- uses: actions/setup-node@v3
1111
with:
12-
node-version-file: 'package.json'
12+
node-version-file: package.json
1313
- run: echo "registry=https://registry.npmjs.org/" > .npmrc
1414
- run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
1515
env:

.github/workflows/reviewdog.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v2
1515
- uses: actions/setup-node@v3
1616
with:
17-
node-version-file: 'package.json'
17+
node-version-file: package.json
1818

1919
- run: npm ci
2020
- run: npm audit signatures
@@ -36,7 +36,7 @@ jobs:
3636
filter_mode: added
3737
level: warning
3838
fail_on_error: false
39-
eslint_flags: '. --report-unused-disable-directives'
39+
eslint_flags: . --report-unused-disable-directives
4040

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

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v2
1212
- uses: actions/setup-node@v3
1313
with:
14-
node-version-file: 'package.json'
14+
node-version-file: package.json
1515

1616
- run: npm ci
1717
- run: npm audit signatures

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"javascript",
77
"javascriptreact",
88
"typescript",
9-
"typescriptreact"
9+
"typescriptreact",
10+
"yaml"
1011
],
1112
"editor.defaultFormatter": "esbenp.prettier-vscode",
1213
"editor.formatOnSave": true,

0 commit comments

Comments
 (0)