From 6c8f830ea9fbf17337ae93e346d6642021d81724 Mon Sep 17 00:00:00 2001 From: Adrien ERAUD Date: Tue, 11 Jun 2024 18:22:52 +0200 Subject: [PATCH] Bump dependencies --- .editorconfig | 2 +- .eslintignore | 5 ----- .eslintrc.cjs | 12 ---------- .github/workflows/quality-control.yml | 2 +- .prettierrc.cjs | 18 --------------- .vscode/settings.json | 26 +++++++++++++--------- eslint.config.mjs | 32 +++++++++++++++++++++++++++ package.json | 26 ++++++++++++---------- prettier.config.mjs | 20 +++++++++++++++++ 9 files changed, 83 insertions(+), 60 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.cjs delete mode 100644 .prettierrc.cjs create mode 100644 eslint.config.mjs create mode 100644 prettier.config.mjs diff --git a/.editorconfig b/.editorconfig index 9759579..4e0b0da 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,6 @@ insert_final_newline = false indent_style = space indent_size = 2 -[*.js] +[*.{js,ts,cjs,mjs}] indent_style = space indent_size = 2 \ No newline at end of file diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 79166fa..0000000 --- a/.eslintignore +++ /dev/null @@ -1,5 +0,0 @@ -# Yarn & node.js dependencies -package.json -node_modules/ -.pnp.* -.yarn/* \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 03f83ed..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable no-undef */ -module.exports = { - root: true, - env: { - es2022: true, - browser: true, - }, - extends: ["eslint:recommended", "prettier"], - parserOptions: { - sourceType: "module", - }, -}; diff --git a/.github/workflows/quality-control.yml b/.github/workflows/quality-control.yml index 3b803ec..a56c28f 100644 --- a/.github/workflows/quality-control.yml +++ b/.github/workflows/quality-control.yml @@ -40,7 +40,7 @@ jobs: strategy: matrix: - node-version: [18.x, 20.x] + node-version: [20.x, 22.x] steps: - uses: actions/checkout@v4 diff --git a/.prettierrc.cjs b/.prettierrc.cjs deleted file mode 100644 index 63f23cc..0000000 --- a/.prettierrc.cjs +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - printWidth: 120, - trailingComma: "es5", - overrides: [ - { - files: [".eslintrc.*", ".prettierrc.*", "*.json", "*.md"], - options: { - printWidth: 80, - }, - }, - { - files: ["tsconfig.json"], - options: { - trailingComma: "none", - }, - }, - ], -}; diff --git a/.vscode/settings.json b/.vscode/settings.json index 0a2e278..85519aa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,6 +14,12 @@ "**/node_modules/**": true, "**/.yarn/**": true }, + "editor.formatOnSave": true, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.codeActionsOnSave": { + "source.fixAll": "explicit", + "source.organizeImports": "explicit" + }, "[javascript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, @@ -23,20 +29,18 @@ "[scss]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, - "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "editor.codeActionsOnSave": { - "source.fixAll": "explicit", - "source.organizeImports": "explicit" - }, "eslint.enable": true, - "eslint.format.enable": true, - "prettier.configPath": ".prettierrc.cjs", - "prettier.ignorePath": ".prettierignore", + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact" + ], "css.validate": false, "less.validate": false, "scss.validate": false, "stylelint.enable": true, - "stylelint.validate": ["css", "scss"] + "stylelint.validate": ["css", "scss"], + "prettier.configPath": "prettier.config.mjs", + "prettier.ignorePath": ".prettierignore" } diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..6ed87cb --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,32 @@ +import eslint from "@eslint/js"; +import prettierConfig from "eslint-config-prettier"; +import globals from "globals"; + +export default [ + eslint.configs.recommended, + { + languageOptions: { + ecmaVersion: 2022, + globals: { + ...globals.es2022, + ...globals.browser, + }, + }, + rules: { + "no-unused-vars": [ + "error", + { + vars: "all", + args: "after-used", + argsIgnorePattern: "^_", + caughtErrors: "all", + caughtErrorsIgnorePattern: "^_", + }, + ], + }, + }, + prettierConfig, + { + ignores: ["package.json", "node_modules/*", ".yarn/*"], + }, +]; diff --git a/package.json b/package.json index 4b5d416..dcea905 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "access": "public" }, "engines": { - "node": "18.x || 20.x" + "node": "20.x || 22.x" }, "browserslist": [ "Chrome >= 60", @@ -26,12 +26,12 @@ "scripts": { "freshlock": "rm -rf node_modules/ && rm .yarn/install-state.gz && rm yarn.lock && yarn", "eslint-check": "eslint-config-prettier src/index.js", - "check-js": "eslint . --ext .js", + "check-js": "eslint", "check-sass": "stylelint **/*.scss", - "check-style": "prettier --check \"**/*.{cjs,mjs,js,scss,json,html,yml,md}\"", - "lint-js": "eslint . --fix --ext .js", + "check-style": "prettier --check .", + "lint-js": "eslint --fix", "lint-sass": "stylelint **/*.scss --fix", - "format": "prettier --write \"**/*.{cjs,mjs,js,scss,json,html,yml,md}\"", + "format": "prettier --write .", "test": "npx ava", "server": "webpack serve --mode development --config server/button.webpack.js --hot --open" }, @@ -44,29 +44,31 @@ "button" ], "devDependencies": { - "@babel/core": "^7.24.6", - "@babel/preset-env": "^7.24.6", + "@babel/core": "^7.24.7", + "@babel/preset-env": "^7.24.7", + "@eslint/js": "^9.4.0", "ava": "^6.1.3", "babel-loader": "^9.1.3", "css-loader": "^7.1.2", - "eslint": "^8.57.0", + "eslint": "^9.4.0", "eslint-config-prettier": "^9.1.0", + "globals": "^15.4.0", "js-cookie": "^3.0.5", "jsdom": "^24.1.0", "mini-css-extract-plugin": "^2.9.0", "postcss": "^8.4.38", - "prettier": "^3.2.5", - "sass": "^1.77.2", + "prettier": "^3.3.2", + "sass": "^1.77.4", "sass-loader": "^14.2.1", "style-loader": "^4.0.0", "stylelint": "^16.6.1", "stylelint-config-sass-guidelines": "^11.1.0", - "webpack": "^5.91.0", + "webpack": "^5.92.0", "webpack-cli": "^5.1.4", "webpack-dev-server": "^5.0.4" }, "peerDependencies": { "js-cookie": "^3.0.5" }, - "packageManager": "yarn@4.2.2" + "packageManager": "yarn@4.3.0" } diff --git a/prettier.config.mjs b/prettier.config.mjs new file mode 100644 index 0000000..6d51fcf --- /dev/null +++ b/prettier.config.mjs @@ -0,0 +1,20 @@ +const config = { + printWidth: 120, + trailingComma: "es5", + overrides: [ + { + files: ["eslint.config.mjs", "prettier.config.mjs", "*.json", "*.md"], + options: { + printWidth: 80, + }, + }, + { + files: ["tsconfig.json"], + options: { + trailingComma: "none", + }, + }, + ], +}; + +export default config;