Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gogocode-plugin-prettier): support to format code by config file #168

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ckangwen
Copy link

@ckangwen ckangwen commented Jun 30, 2022

Description

这个PR是用于解决gogocode-plugin-prettier无法自定义配置项的问题。
对此提供了一个加载prettier配置文件的功能。

This PR is to solve the problem that gogocode-plugin-prettier cannot customize code format style.
Now provide a feature that support to load a prettier configuration file.

API

gogocode -s input.js -t gogocode-plugin-prettier -o output.js -p prettierrc=.prettierrc.json

Fixes

#166

trailingComma: 'es5',
tabWidth: 2,
semi: false,
singleQuote: true,
printWidth: 80,
parser: /\.vue$/.test(fileInfo.path) ? 'vue' : 'typescript',
});
};
const { prettierrc, rootPath } = options

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the command gogocode -s dir/input.js -t gogocode-plugin-prettier -o dir/output.js -p prettierrc=.prettierrc.json, rootPath value here would be dir instead of current working directory.

Probably options.pwdPath makes more sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants