Skip to content

Commit 9cdd072

Browse files
committed
Updated package dependencies and improved ESLint configuration
1 parent 2bb2c91 commit 9cdd072

File tree

30 files changed

+749
-471
lines changed

30 files changed

+749
-471
lines changed

.eslintrc.json

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

.github/workflows/nextjs.yml

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@ on:
66
tags:
77
- 'v[0-9]+.[0-9]+.[0-9]+'
88

9-
# Allows you to run this workflow manually from the Actions tab
10-
workflow_dispatch:
11-
129
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1310
permissions:
1411
contents: read
15-
pages: write
1612
id-token: write
13+
pages: write
1714

1815
# Allow one concurrent deployment
1916
concurrency:
@@ -111,37 +108,6 @@ jobs:
111108
- name: Perform code linting
112109
run: pnpm lint
113110

114-
prettier:
115-
name: Validate code formatting
116-
runs-on: ubuntu-latest
117-
needs: deps
118-
steps:
119-
- name: Checkout
120-
uses: actions/checkout@v4
121-
122-
- name: Restore application dependencies
123-
uses: actions/cache/restore@v4
124-
id: cache
125-
with:
126-
key: ${{ runner.os }}-node-modules-${{ hashFiles('pnpm-lock.yaml') }}
127-
path: |
128-
node_modules
129-
fail-on-cache-miss: true
130-
131-
- name: Install pnpm
132-
uses: pnpm/action-setup@v3
133-
with:
134-
version: 9
135-
136-
- name: Setup Node.js
137-
uses: actions/setup-node@v4
138-
with:
139-
node-version: 20
140-
cache: pnpm
141-
142-
- name: Validate code formatting
143-
run: pnpm prettier
144-
145111
# Build job
146112
build:
147113
name: Build
@@ -153,7 +119,6 @@ jobs:
153119
needs:
154120
- audit
155121
- lint
156-
- prettier
157122
steps:
158123
- name: Checkout
159124
uses: actions/checkout@v4

.husky/pre-commit

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
npm run prettier
54
npm run lint

eslint.config.js

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
const { resolve } = require('node:path');
2+
const globals = require('globals');
3+
const pluginNext = require('@next/eslint-plugin-next');
4+
const pluginReact = require('eslint-plugin-react');
5+
const pluginReactHooks = require('eslint-plugin-react-hooks');
6+
const parserTypeScript = require('@typescript-eslint/parser');
7+
const pluginImport = require('eslint-plugin-import');
8+
const pluginPrettier = require('eslint-plugin-prettier/recommended');
9+
const pluginTypeScript = require('@typescript-eslint/eslint-plugin');
10+
11+
const tsconfigPath = resolve(process.cwd(), 'tsconfig.json');
12+
13+
/** @type {Array<import('eslint').Linter.FlatConfig>} */
14+
module.exports = [
15+
{
16+
ignores: ['**/.next', '**/out/', '**/*.{js,json,md,mjs,scss}'],
17+
},
18+
19+
{
20+
plugins: {
21+
'@typescript-eslint': pluginTypeScript,
22+
'import': pluginImport,
23+
},
24+
},
25+
26+
{
27+
languageOptions: {
28+
parser: parserTypeScript,
29+
parserOptions: {
30+
project: tsconfigPath,
31+
},
32+
},
33+
settings: {
34+
'import/resolver': {
35+
typescript: {
36+
project: tsconfigPath,
37+
},
38+
},
39+
},
40+
},
41+
42+
{
43+
files: ['**/*.{ts,tsx}'],
44+
rules: {
45+
// Enforce consistent usage of type imports
46+
'@typescript-eslint/consistent-type-imports': 'error',
47+
48+
// Enforce shorthand boolean component properties
49+
'react/jsx-boolean-value': ['error', 'never'],
50+
51+
// Ensure component properties are alphabetically sorted with callbacks being last
52+
'react/jsx-sort-props': [
53+
'error',
54+
{
55+
callbacksLast: true,
56+
}
57+
],
58+
59+
// Ensure the `type` keyword is always outside the import braces
60+
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
61+
62+
// Enforce consistent import order
63+
'import/order': [
64+
'error',
65+
{
66+
'alphabetize': {
67+
caseInsensitive: true,
68+
order: 'asc',
69+
},
70+
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object'],
71+
'pathGroups': [
72+
{
73+
pattern: '{.,..}/types',
74+
group: 'object',
75+
position: 'after',
76+
},
77+
{
78+
pattern: '*.{jpg,jpeg,gif,png,svg}',
79+
group: 'object',
80+
patternOptions: {
81+
matchBase: true,
82+
},
83+
position: 'after',
84+
},
85+
{
86+
pattern: '*.{css,scss}',
87+
group: 'object',
88+
patternOptions: {
89+
matchBase: true,
90+
},
91+
position: 'after',
92+
},
93+
],
94+
'newlines-between': 'never',
95+
},
96+
],
97+
},
98+
},
99+
100+
{
101+
plugins: {
102+
react: pluginReact,
103+
},
104+
rules: pluginReact.configs['jsx-runtime'].rules,
105+
},
106+
107+
{
108+
plugins: {
109+
'react-hooks': pluginReactHooks,
110+
},
111+
rules: pluginReactHooks.configs.recommended.rules,
112+
},
113+
114+
{
115+
languageOptions: {
116+
globals: {
117+
...globals.es2021,
118+
...globals.jest,
119+
},
120+
parserOptions: {
121+
ecmaFeatures: {
122+
jsx: true,
123+
},
124+
},
125+
},
126+
},
127+
128+
{
129+
plugins: {
130+
'@next/next': pluginNext,
131+
},
132+
rules: {
133+
...pluginNext.configs.recommended.rules,
134+
...pluginNext.configs['core-web-vitals'].rules,
135+
"@next/next/no-img-element": "off",
136+
},
137+
},
138+
139+
{
140+
languageOptions: {
141+
globals: {
142+
...globals.es2021,
143+
...globals.jest,
144+
...globals.node,
145+
},
146+
},
147+
},
148+
149+
// Include Prettier validation in the linting pipeline
150+
pluginPrettier,
151+
];

package.json

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,52 +8,58 @@
88
"companion": "tsx --trace-warnings ./src/scripts/companion",
99
"dev": "next dev",
1010
"https": "pnpm dlx local-ssl-proxy --key localhost-key.pem --cert localhost.pem --source 3001 --target 3000",
11-
"lint": "next lint",
12-
"lint:fix": "next lint --fix",
11+
"lint": "eslint .",
12+
"lint:fix": "eslint . --fix",
1313
"prepare": "husky install",
14-
"prettier": "prettier ./src --check",
15-
"prettier:fix": "prettier ./src --fix",
1614
"start": "next start"
1715
},
1816
"dependencies": {
1917
"@svgr/webpack": "^8.1.0",
2018
"clsx": "^2.1.1",
2119
"color": "^4.2.3",
22-
"get-user-locale": "^2.3.0",
23-
"loader-utils": "^3.2.1",
20+
"get-user-locale": "^2.3.2",
21+
"loader-utils": "^3.3.1",
2422
"modern-normalize": "^2.0.0",
25-
"next": "^14.1.1",
23+
"next": "^14.2.4",
2624
"path": "^0.12.7",
27-
"react": "^18.2.0",
25+
"react": "^18.3.1",
2826
"react-color": "^2.19.3",
29-
"react-dom": "^18.2.0",
30-
"react-icons": "^5.0.1",
31-
"react-intl": "^6.6.2",
27+
"react-dom": "^18.3.1",
28+
"react-icons": "^5.2.1",
29+
"react-intl": "^6.6.8",
3230
"react-slider": "^2.0.6",
33-
"react-spinners": "^0.13.8",
34-
"react-toastify": "^10.0.4",
31+
"react-spinners": "^0.14.1",
32+
"react-toastify": "^10.0.5",
3533
"react-transition-group": "^4.4.5",
3634
"sha1": "^1.1.1",
3735
"use-resize-observer": "^9.1.0"
3836
},
3937
"devDependencies": {
38+
"@next/eslint-plugin-next": "^14.2.3",
4039
"@types/color": "^3.0.6",
41-
"@types/node": "^20.11.17",
42-
"@types/react": "^18.2.55",
43-
"@types/react-color": "^3.0.11",
44-
"@types/react-dom": "^18.2.19",
40+
"@types/node": "^20.14.9",
41+
"@types/react": "^18.3.3",
42+
"@types/react-color": "^3.0.12",
43+
"@types/react-dom": "^18.3.0",
4544
"@types/react-slider": "^1.3.6",
4645
"@types/react-transition-group": "^4.4.10",
4746
"@types/sha1": "^1.1.5",
48-
"@typescript-eslint/eslint-plugin": "^6.21.0",
49-
"@typescript-eslint/parser": "^6.21.0",
50-
"eslint": "^8.56.0",
51-
"eslint-config-next": "^14.1.0",
52-
"husky": "^9.0.10",
53-
"prettier": "^3.2.5",
47+
"@typescript-eslint/eslint-plugin": "^7.9.0",
48+
"@typescript-eslint/parser": "^7.14.1",
49+
"eslint": "^8.57.0",
50+
"eslint-config-next": "^14.2.4",
51+
"eslint-config-prettier": "^9.1.0",
52+
"eslint-import-resolver-typescript": "^3.6.1",
53+
"eslint-plugin-import": "^2.29.1",
54+
"eslint-plugin-prettier": "^5.1.3",
55+
"eslint-plugin-react": "^7.34.3",
56+
"eslint-plugin-react-hooks": "^4.6.2",
57+
"globals": "^15.6.0",
58+
"husky": "^9.0.11",
59+
"prettier": "^3.3.2",
5460
"process": "^0.11.10",
5561
"tsconfig-paths": "^4.2.0",
56-
"tsx": "^4.11.0",
57-
"typescript": "^5.3.3"
62+
"tsx": "^4.15.7",
63+
"typescript": "^5.5.2"
5864
}
5965
}

0 commit comments

Comments
 (0)