diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..b6f4d83 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +# Files to ignore +**/.angular diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..9e77430 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,24 @@ +{ + "bracketSameLine": true, + "printWidth": 160, + "quoteProps": "consistent", + "semi": true, + "singleAttributePerLine": false, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "es5", + "overrides": [ + { + "files": ["*.css", "*.yml"], + "options": { + "singleQuote": false + } + }, + { + "files": ["*.css", "*.html"], + "options": { + "printWidth": 500 + } + } + ] +} diff --git a/package-lock.json b/package-lock.json index 794d6c3..a44b592 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "MIT", "devDependencies": { "echarts": "^5.5.0", + "prettier": "^3.2.5", "serve": "^14.2.2", "ts-loader": "^9.5.1", "typedoc": "^0.25.13", @@ -1587,6 +1588,21 @@ "node": ">=8" } }, + "node_modules/prettier": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", diff --git a/package.json b/package.json index c9ce20e..30a65a1 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,8 @@ "build": "webpack", "copyright-year": "node build/bump-copyright-year.mjs", "netlify": "npm run build && cp -R dist docs/ && npm run typedoc", + "prettier:check": "prettier --check .", + "prettier:update": "prettier --write .", "release": "npm pack && npm publish", "serve": "npm run typedoc && serve .", "serve:angular": "serve test/angular-ngx-echarts/dist/angular/", @@ -26,6 +28,7 @@ }, "devDependencies": { "echarts": "^5.5.0", + "prettier": "^3.2.5", "serve": "^14.2.2", "ts-loader": "^9.5.1", "typedoc": "^0.25.13",