Skip to content

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

@Flet

Description

@Flet

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions