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

add option/flag to invoke eslint's --fix feature #107

Closed
Flet opened this issue May 16, 2016 · 4 comments · Fixed by #112
Closed

add option/flag to invoke eslint's --fix feature #107

Flet opened this issue May 16, 2016 · 4 comments · Fixed by #112

Comments

@Flet
Copy link
Member

Flet commented May 16, 2016

Passing through a --fix flag/option to eslint might be a nice, lightweight alternative to using a full formatter like standard-format without adding any additional dependencies,

Looking at standard, about 25% of the rules are covered by --fix currently:

arrow-spacing: enforce consistent spacing before and after the arrow in arrow functions 
block-spacing: enforce consistent spacing inside single-line blocks 
comma-dangle: require or disallow trailing commas  
comma-spacing: enforce consistent spacing before and after commas 
eol-last: enforce at least one newline at the end of files 
generator-star-spacing: enforce consistent spacing around * operators in generator functions 
indent: enforce consistent indentation 
jsx-quotes: enforce the consistent use of either double or single quotes in JSX attributes 
keyword-spacing: enforce consistent spacing before and after keywords 
no-multi-spaces: disallow multiple spaces 
no-spaced-func: disallow spacing between function identifiers and their applications 
no-trailing-spaces: disallow trailing whitespace at the end of lines 
no-whitespace-before-property: disallow whitespace before properties 
quotes: enforce the consistent use of either backticks, double, or single quotes 
semi-spacing: enforce consistent spacing before and after semicolons 
semi: require or disallow semicolons instead of ASI 
space-before-blocks: enforce consistent spacing before blocks 
space-before-function-paren: enforce consistent spacing before function definition opening parenthesis 
space-in-parens: enforce consistent spacing inside parentheses 
space-infix-ops: require spacing around operators 
space-unary-ops: enforce consistent spacing before or after unary operators 
spaced-comment: enforce consistent spacing after the // or /* in a comment 
template-curly-spacing: require or disallow spacing around embedded expressions of template strings 
yield-star-spacing: require or disallow spacing around the * in yield* expressions

This is a lot more rules than last time I checked!

I'd like to see standard-engine expose a --fix flag via the CLI as well as opts.fix for programmatic usage.

Thoughts?

@feross
Copy link
Member

feross commented May 16, 2016

Sounds good to me!

@2color
Copy link

2color commented Jun 20, 2016

I'd love to see this!

@Flet I'd like to help out implementing this.
A quick glimpse revealed that the current implementation relies on opts.formatter to have transform function. What implementation did you have in mind?

@Flet
Copy link
Member Author

Flet commented Jun 21, 2016

@2color Sure, go for it :)

It should be just adding fix: true to the eslintConfig in parseOpts if opts.fix is passed in.
We should also update cmd.js to allow it to be passed via CLI.

@feross
Copy link
Member

feross commented Jul 12, 2016

Here's a PR to add support for --fix: #112

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

Successfully merging a pull request may close this issue.

3 participants