From 4ed74c91e4a24e200879e9f6781543dd050e19ba Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Tue, 12 Nov 2024 01:39:31 +0800 Subject: [PATCH] fix: when using prettier, enforce line endings and max line length in EditorConfig too Fixes #36 --- index.js | 1 + templates/_editorconfig.ejs | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 424b75b..e4d995d 100644 --- a/index.js +++ b/index.js @@ -106,6 +106,7 @@ export default function createConfig({ const templateData = { styleGuide, + needsPrettier, fileExtensions, configsBeforeVuePlugin, configsAfterVuePlugin, diff --git a/templates/_editorconfig.ejs b/templates/_editorconfig.ejs index 9cdd5ec..f72a9a2 100644 --- a/templates/_editorconfig.ejs +++ b/templates/_editorconfig.ejs @@ -4,12 +4,13 @@ indent_size = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true -<%_ if (styleGuide === 'airbnb') { _%> -<%# // standard doesn't have an opinion on line endings +<%_ if (styleGuide !== 'standard' || needsPrettier) { _%> +<%# +// standard doesn't have an opinion on line endings // https://github.com/standard/standard/issues/140 // or maximum line length // https://github.com/standard/standard/issues/1559 -// so we only configure them for airbnb style +// Prettier enforces these things, though. %> end_of_line = lf max_line_length = 100