build: use prettier for linting

This commit is contained in:
Nick the Sick 2024-11-01 17:16:15 +01:00
parent f7453a3292
commit 6be1f7b15d
No known key found for this signature in database
GPG Key ID: F575992F156E5BCC
5 changed files with 89 additions and 38 deletions

View File

@ -9,28 +9,12 @@ module.exports = {
},
overrides: [
{
files: [
'./**/*.ts',
'./**/*.tsx',
'./**/*.js',
'./**/*.jsx',
],
files: ['./**/*.ts', './**/*.tsx', './**/*.js', './**/*.jsx'],
extends: ['plugin:react-hooks/recommended'],
},
{
files: [
'./**/*.ts',
'./**/*.tsx',
'./**/*.js',
'./**/*.jsx',
'./**/*.vue',
],
plugins: [
'html',
'cypress',
'@typescript-eslint',
'simple-import-sort',
],
files: ['./**/*.ts', './**/*.tsx', './**/*.js', './**/*.jsx', './**/*.vue'],
plugins: ['html', 'cypress', '@typescript-eslint', 'simple-import-sort'],
env: {
'cypress/globals': true,
},
@ -43,17 +27,18 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-strongly-recommended',
'airbnb-base',
'prettier',
],
rules: {
curly: ['error', 'all'],
'newline-after-var': ['error', 'always'],
'no-continue': 'off',
'no-alert': 'off',
'no-console': ['warn', { allow: ['warn', 'error'] }],
semi: ['error', 'never'],
'import/order': 'off',
'import/extensions': ['error', 'ignorePackages'],
'no-restricted-imports': ['error',
'no-restricted-imports': [
'error',
{
paths: [
{
@ -81,14 +66,6 @@ module.exports = {
'vue/one-component-per-file': 'off',
'vue/this-in-template': ['error', 'never'],
'vue/multi-word-component-names': 'off',
'vue/max-attributes-per-line': ['error', {
singleline: {
max: 3,
},
multiline: {
max: 1,
},
}],
'vue/singleline-html-element-content-newline': 'off',
'no-param-reassign': 'off',
'import/prefer-default-export': 'off',

View File

@ -1,3 +1,3 @@
module.exports = {
"./**/*.{ts,tsx,js,jsx,vue}": ["eslint --fix --quiet --no-error-on-unmatched-pattern"],
};
'./**/*.{ts,tsx,js,jsx,vue}': ['prettier --write', 'eslint --fix --quiet --no-error-on-unmatched-pattern'],
}

8
.prettierrc Normal file
View File

@ -0,0 +1,8 @@
{
"trailingComma": "all",
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"arrowParens": "avoid",
"printWidth": 120
}

74
package-lock.json generated
View File

@ -29,6 +29,7 @@
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-cypress": "^2.15.2",
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-import": "^2.29.1",
@ -38,6 +39,7 @@
"husky": "^8.0.3",
"lint-staged": "^15.2.10",
"minimist": "^1.2.8",
"prettier": "3.3.3",
"ts-loader": "9.3.1",
"tsup": "8.2.4",
"turbo": "2.0.6",
@ -2098,6 +2100,22 @@
"semver": "^7.5.3"
}
},
"node_modules/@changesets/apply-release-plan/node_modules/prettier": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
"dev": true,
"license": "MIT",
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/@changesets/apply-release-plan/node_modules/semver": {
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
@ -2371,6 +2389,22 @@
"prettier": "^2.7.1"
}
},
"node_modules/@changesets/write/node_modules/prettier": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
"dev": true,
"license": "MIT",
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/@colors/colors": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
@ -9182,6 +9216,19 @@
"eslint-plugin-import": "^2.25.2"
}
},
"node_modules/eslint-config-prettier": {
"version": "9.1.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz",
"integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==",
"dev": true,
"license": "MIT",
"bin": {
"eslint-config-prettier": "bin/cli.js"
},
"peerDependencies": {
"eslint": ">=7.0.0"
}
},
"node_modules/eslint-import-resolver-node": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz",
@ -14186,16 +14233,16 @@
}
},
"node_modules/prettier": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
"integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
"dev": true,
"license": "MIT",
"bin": {
"prettier": "bin-prettier.js"
"prettier": "bin/prettier.cjs"
},
"engines": {
"node": ">=10.13.0"
"node": ">=14"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
@ -19214,6 +19261,23 @@
"prettier": "^1.18.2 || ^2.0.0"
}
},
"packages/vue-2/node_modules/prettier": {
"version": "2.8.8",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==",
"dev": true,
"license": "MIT",
"optional": true,
"bin": {
"prettier": "bin-prettier.js"
},
"engines": {
"node": ">=10.13.0"
},
"funding": {
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"packages/vue-2/node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",

View File

@ -14,8 +14,8 @@
"cz": "cz",
"start": "npm --prefix ./demos run start",
"dev": "npm run start",
"lint": "eslint --cache --quiet --no-error-on-unmatched-pattern ./",
"lint:fix": "eslint --fix --cache --quiet --no-error-on-unmatched-pattern ./",
"lint": "prettier . --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./",
"lint:fix": "prettier . --write && eslint --fix --cache --quiet --no-error-on-unmatched-pattern ./",
"lint:staged": "lint-staged",
"test:open": "cypress open --project tests",
"test:run": "cypress run --project tests",
@ -53,6 +53,7 @@
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-cypress": "^2.15.2",
"eslint-plugin-html": "^6.2.0",
"eslint-plugin-import": "^2.29.1",
@ -62,6 +63,7 @@
"husky": "^8.0.3",
"lint-staged": "^15.2.10",
"minimist": "^1.2.8",
"prettier": "3.3.3",
"ts-loader": "9.3.1",
"tsup": "8.2.4",
"turbo": "2.0.6",