├── .editorconfig ├── .eslintignore ├── .eslintrc.cjs ├── .gitattributes ├── .gitignore ├── .husky ├── commit-msg └── pre-commit ├── .npmrc ├── .testignore ├── .vscode └── settings.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── package.json ├── pnpm-lock.yaml ├── src ├── configs.ts ├── index.ts └── rules │ ├── index.ts │ └── prettier │ ├── create.ts │ ├── index.ts │ ├── meta.ts │ ├── types.ts │ ├── utils │ ├── parse-vue.ts │ ├── report-difference.ts │ ├── resolve-prettier-file-info.ts │ ├── resolve-prettier-options.ts │ └── run-prettier-and-report-differences.ts │ └── workers │ ├── prettier-format.ts │ └── resolve-prettier-options-and-file-info.ts ├── test ├── cutom-blocks.vue ├── empty-style.vue ├── fragment.vue ├── ignored.vue ├── js-scss.vue ├── non-script.vue ├── setup-script.vue ├── ts-less.vue └── unsupported-format.vue ├── tsconfig.base.json ├── tsconfig.build.json └── tsconfig.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | node_modules/ 3 | !.*.js 4 | -------------------------------------------------------------------------------- /.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | 4 | overrides: [ 5 | { 6 | files: ['*.js'], 7 | extends: '@meteorlxy/prettier', 8 | }, 9 | { 10 | files: ['*.ts'], 11 | extends: '@meteorlxy/prettier-typescript', 12 | parserOptions: { 13 | project: ['tsconfig.json'], 14 | }, 15 | rules: { 16 | 'no-console': 'off', 17 | '@typescript-eslint/no-unsafe-assignment': 'off', 18 | '@typescript-eslint/no-unsafe-member-access': 'off', 19 | }, 20 | }, 21 | { 22 | files: ['*.vue'], 23 | extends: ['@meteorlxy/typescript-vue', 'plugin:prettier-vue/recommended'], 24 | parserOptions: { 25 | project: ['tsconfig.json'], 26 | }, 27 | rules: { 28 | 'prettier-vue/prettier': [ 29 | 'error', 30 | { 31 | // singleQuote: false, 32 | // semi: true, 33 | // trailingComma: 'none', 34 | }, 35 | ], 36 | }, 37 | }, 38 | ], 39 | 40 | settings: { 41 | 'prettier-vue': { 42 | SFCBlocks: { 43 | template: false, 44 | script: true, 45 | style: true, 46 | customBlocks: { 47 | 'docs': { lang: 'markdown' }, 48 | 'no-prettier-block': false, 49 | }, 50 | }, 51 | usePrettierrc: true, 52 | fileInfoOptions: { 53 | ignorePath: '.testignore', 54 | }, 55 | }, 56 | }, 57 | }; 58 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | *.txt text eol=crlf 3 | 4 | *.png binary 5 | *.jpg binary 6 | *.jpeg binary 7 | *.ico binary 8 | *.tff binary 9 | *.woff binary 10 | *.woff2 binary 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | node_modules/ 3 | .DS_Store 4 | *.log 5 | *.tsbuildinfo 6 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | pnpm commitlint --edit $1 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | pnpm lint-staged 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | message=build: version %s 2 | -------------------------------------------------------------------------------- /.testignore: -------------------------------------------------------------------------------- 1 | test/ignored.vue 2 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.insertSpaces": true, 3 | "editor.tabSize": 2, 4 | "files.encoding": "utf8", 5 | "files.eol": "\n", 6 | "files.trimFinalNewlines": true, 7 | "files.trimTrailingWhitespace": true, 8 | "[markdown]": { 9 | "files.trimTrailingWhitespace": false 10 | }, 11 | "eslint.validate": [ 12 | "javascript", 13 | "javascriptreact", 14 | "typescript", 15 | "typescriptreact", 16 | "vue" 17 | ], 18 | "cSpell.words": ["invisibles"] 19 | } 20 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # [5.0.0](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v4.2.0...v5.0.0) (2023-08-25) 2 | 3 | ### Build System 4 | 5 | - update build target to node 16 ([6599897](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/659989780f42232667b5e4467144d8c1dc41413e)) 6 | 7 | ### Features 8 | 9 | - upgrade to prettier v3 (close [#35](https://github.com/meteorlxy/eslint-plugin-prettier-vue/issues/35)) ([453229a](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/453229ae899c8d09e33e9052e4c7eff3c1a62d40)) 10 | 11 | ### BREAKING CHANGES 12 | 13 | - upgrade to prettier v3 14 | - drop support for node 14 15 | 16 | # [4.2.0](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v4.1.0...v4.2.0) (2022-06-30) 17 | 18 | ### Features 19 | 20 | - sync some changes from eslint-plugin-prettier ([196a5cf](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/196a5cf619ded469a2a78c64b05387f09ecc726a)) 21 | 22 | # [4.1.0](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v4.0.0...v4.1.0) (2022-06-09) 23 | 24 | ### Features 25 | 26 | - update options schema to prettier 2.6 ([fda709d](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/fda709d8cae49434301d6db850e8ede119ef10a8)) 27 | 28 | # [4.0.0](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v3.1.0...v4.0.0) (2022-06-09) 29 | 30 | ### Build System 31 | 32 | - migrate to pnpm and bump dependencies ([897ce8a](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/897ce8ab84099e6d2db8b40267c3d57d2665cf26)) 33 | 34 | ### BREAKING CHANGES 35 | 36 | - drop support for node 10 & 12 37 | 38 | # [3.1.0](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v3.0.0...v3.1.0) (2021-05-28) 39 | 40 | ### Features 41 | 42 | - support setup script ([#18](https://github.com/meteorlxy/eslint-plugin-prettier-vue/issues/18)) ([49e71f4](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/49e71f494b6ad617cdda290c956ae0dd2305fdbc)) 43 | 44 | # [3.0.0](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v3.0.0-alpha.2...v3.0.0) (2021-04-21) 45 | 46 | # [3.0.0-alpha.2](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v3.0.0-alpha.1...v3.0.0-alpha.2) (2020-08-07) 47 | 48 | # [3.0.0-alpha.1](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v2.1.1...v3.0.0-alpha.1) (2020-08-07) 49 | 50 | ### Features 51 | 52 | - use vue 3 compiler-sfc and migrate to typescript ([db976d1](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/db976d173368d5b87a9beda2457fb5de71acc8af)) 53 | 54 | ## [2.1.1](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v2.1.0...v2.1.1) (2020-07-24) 55 | 56 | ### Bug Fixes 57 | 58 | - support vue-indent-script-and-style option (close [#12](https://github.com/meteorlxy/eslint-plugin-prettier-vue/issues/12)) ([ec36426](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/ec364265f132cf9201647ac2440b33c404dfe561)) 59 | 60 | # [2.1.0](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v2.0.2...v2.1.0) (2020-04-28) 61 | 62 | ### Features 63 | 64 | - support prettier 2.0 ([fe58782](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/fe587826c52f10afc5582397a7d4afb21845b68f)) 65 | 66 | ## [2.0.2](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v2.0.1...v2.0.2) (2019-10-24) 67 | 68 | ### Bug Fixes 69 | 70 | - warning for unsupported file format ([1c6b918](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/1c6b918)) 71 | 72 | ## [2.0.1](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v2.0.0...v2.0.1) (2019-10-22) 73 | 74 | ### Bug Fixes 75 | 76 | - add prefix to avoid cache ([d80eaaf](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/d80eaaf)) 77 | 78 | # [2.0.0](https://github.com/meteorlxy/eslint-plugin-prettier-vue/compare/v1.1.3...v2.0.0) (2019-08-22) 79 | 80 | ### Features 81 | 82 | - make this plugin more flexible ([e67cffd](https://github.com/meteorlxy/eslint-plugin-prettier-vue/commit/e67cffd)) 83 | - ability to process `