enhance: Configure Prettier

This commit is contained in:
まっちゃとーにゅ 2023-08-17 02:39:31 +09:00
parent 2be2b0facc
commit 5e9201f3e8
No known key found for this signature in database
GPG Key ID: 6AFBBF529601C1DB
13 changed files with 671 additions and 291 deletions

9
.prettierignore Normal file
View File

@ -0,0 +1,9 @@
node_modules/
packages/*/node_modules
.pnpm-store
build/
built/
misskey-assets/
fluent-emojis/

View File

@ -56,11 +56,15 @@
"devDependencies": { "devDependencies": {
"@types/gulp": "4.0.10", "@types/gulp": "4.0.10",
"@types/gulp-rename": "2.0.1", "@types/gulp-rename": "2.0.1",
"@typescript-eslint/eslint-plugin": "5.61.0", "@typescript-eslint/eslint-plugin": "6.4.0",
"@typescript-eslint/parser": "5.61.0", "@typescript-eslint/parser": "6.4.0",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"cypress": "12.17.1", "cypress": "12.17.1",
"eslint": "8.45.0", "eslint": "8.47.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-prettier": "5.0.0",
"prettier": "3.0.2",
"start-server-and-test": "2.0.0" "start-server-and-test": "2.0.0"
}, },
"optionalDependencies": { "optionalDependencies": {

View File

@ -1,4 +1,5 @@
module.exports = { module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: { parserOptions: {
tsconfigRootDir: __dirname, tsconfigRootDir: __dirname,
project: ['./tsconfig.json', './test/tsconfig.json'], project: ['./tsconfig.json', './test/tsconfig.json'],

View File

@ -198,14 +198,17 @@
"@types/vary": "1.1.0", "@types/vary": "1.1.0",
"@types/web-push": "3.3.2", "@types/web-push": "3.3.2",
"@types/ws": "8.5.5", "@types/ws": "8.5.5",
"@typescript-eslint/eslint-plugin": "5.61.0", "@typescript-eslint/eslint-plugin": "6.4.0",
"@typescript-eslint/parser": "5.61.0", "@typescript-eslint/parser": "6.4.0",
"aws-sdk-client-mock": "3.0.0", "aws-sdk-client-mock": "3.0.0",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"eslint": "8.45.0", "eslint": "8.47.0",
"eslint-plugin-import": "2.27.5", "eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "2.28.0",
"eslint-plugin-prettier": "5.0.0",
"execa": "7.1.1", "execa": "7.1.1",
"jest": "29.6.1", "jest": "29.6.1",
"jest-mock": "29.6.1" "jest-mock": "29.6.1",
"prettier": "3.0.2"
} }
} }

View File

@ -1,7 +1,8 @@
module.exports = { module.exports = {
root: true, root: true,
env: { env: {
'node': false, node: false,
browser: true,
}, },
parser: 'vue-eslint-parser', parser: 'vue-eslint-parser',
parserOptions: { parserOptions: {

View File

@ -112,15 +112,17 @@
"@types/uuid": "9.0.2", "@types/uuid": "9.0.2",
"@types/websocket": "1.0.5", "@types/websocket": "1.0.5",
"@types/ws": "8.5.5", "@types/ws": "8.5.5",
"@typescript-eslint/eslint-plugin": "5.61.0", "@typescript-eslint/eslint-plugin": "6.4.0",
"@typescript-eslint/parser": "5.61.0", "@typescript-eslint/parser": "6.4.0",
"@vitest/coverage-v8": "0.33.0", "@vitest/coverage-v8": "0.33.0",
"@vue/runtime-core": "3.3.4", "@vue/runtime-core": "3.3.4",
"acorn": "8.10.0", "acorn": "8.10.0",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"cypress": "12.17.1", "cypress": "12.17.1",
"eslint": "8.45.0", "eslint": "8.47.0",
"eslint-plugin-import": "2.27.5", "eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "2.28.0",
"eslint-plugin-prettier": "5.0.0",
"eslint-plugin-vue": "9.15.1", "eslint-plugin-vue": "9.15.1",
"fast-glob": "3.3.0", "fast-glob": "3.3.0",
"happy-dom": "10.0.3", "happy-dom": "10.0.3",
@ -128,7 +130,7 @@
"msw": "1.2.2", "msw": "1.2.2",
"msw-storybook-addon": "1.8.0", "msw-storybook-addon": "1.8.0",
"nodemon": "3.0.1", "nodemon": "3.0.1",
"prettier": "3.0.0", "prettier": "3.0.2",
"react": "18.2.0", "react": "18.2.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"start-server-and-test": "2.0.0", "start-server-and-test": "2.0.0",

View File

@ -1,4 +1,5 @@
module.exports = { module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: { parserOptions: {
tsconfigRootDir: __dirname, tsconfigRootDir: __dirname,
project: ['./tsconfig.json'], project: ['./tsconfig.json'],

View File

@ -24,13 +24,17 @@
"@swc/jest": "0.2.26", "@swc/jest": "0.2.26",
"@types/jest": "29.5.3", "@types/jest": "29.5.3",
"@types/node": "20.4.2", "@types/node": "20.4.2",
"@typescript-eslint/eslint-plugin": "5.61.0", "@typescript-eslint/eslint-plugin": "6.4.0",
"@typescript-eslint/parser": "5.61.0", "@typescript-eslint/parser": "6.4.0",
"eslint": "8.45.0", "eslint": "8.47.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-prettier": "5.0.0",
"jest": "29.6.1", "jest": "29.6.1",
"jest-fetch-mock": "3.0.3", "jest-fetch-mock": "3.0.3",
"jest-websocket-mock": "2.4.0", "jest-websocket-mock": "2.4.0",
"mock-socket": "9.2.1", "mock-socket": "9.2.1",
"prettier": "3.0.2",
"tsd": "0.28.1", "tsd": "0.28.1",
"typescript": "5.1.6" "typescript": "5.1.6"
}, },

View File

@ -1,15 +1,17 @@
module.exports = { module.exports = {
root: true, root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'import'
],
extends: [ extends: [
'eslint:recommended', 'eslint:recommended',
'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:import/recommended', 'plugin:import/recommended',
'plugin:import/typescript' 'plugin:import/typescript',
'plugin:prettier/recommended',
],
plugins: [
'@typescript-eslint',
'import',
"prettier",
], ],
rules: { rules: {
'indent': ['warn', 'tab', { 'indent': ['warn', 'tab', {
@ -92,6 +94,7 @@ module.exports = {
'import/no-default-export': ['warn'], 'import/no-default-export': ['warn'],
'import/order': ['warn', { 'import/order': ['warn', {
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'], 'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
}] }],
'prettier/prettier': 'warn',
}, },
}; };

View File

@ -1,10 +1,11 @@
module.exports = { module.exports = {
root: true, root: true,
env: { env: {
browser: true,
node: false, node: false,
}, },
parser: '@typescript-eslint/parser',
parserOptions: { parserOptions: {
parser: '@typescript-eslint/parser',
tsconfigRootDir: __dirname, tsconfigRootDir: __dirname,
project: ['./tsconfig.json'], project: ['./tsconfig.json'],
}, },

View File

@ -14,10 +14,14 @@
"misskey-js": "workspace:*" "misskey-js": "workspace:*"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/parser": "5.61.0", "@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "6.4.0",
"@typescript/lib-webworker": "npm:@types/serviceworker@0.0.67", "@typescript/lib-webworker": "npm:@types/serviceworker@0.0.67",
"eslint": "8.45.0", "eslint": "8.47.0",
"eslint-plugin-import": "2.27.5", "eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "2.28.0",
"eslint-plugin-prettier": "5.0.0",
"prettier": "3.0.2",
"typescript": "5.1.6" "typescript": "5.1.6"
}, },
"type": "module" "type": "module"

File diff suppressed because it is too large Load Diff

13
prettier.config.js Normal file
View File

@ -0,0 +1,13 @@
/** @type {import("prettier").Options} */
module.exports = {
printWidth: 120,
tabWidth: 2,
semi: true,
singleQuote: true,
jsxSingleQuote: true,
trailingComma: 'all',
bracketSpacing: true,
arrowParens: 'avoid',
vueIndentScriptAndStyle: true,
endOfLine: 'lf'
};