-
Notifications
You must be signed in to change notification settings - Fork 47
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
Extend eslint-rules #985
Comments
All suggested rules sound reasonable to me. No objections. The only thing I would look out for is if one of the rules requires changing a lot of code. That can be annoying not only because you have to do the reformatting, but also because that means you cannot any longer easily find out why a given line was changed (last commit). Or rather, the reason will then always be formatting, which isn't helpful. If that is the case I would consider if it is worth applying that specific rule. But I don't think that will be a problem for most of these. I like having these things checked automatically! |
I also want to add: Not sure if we want |
Added more eslint-rules like described in [this issue](elan-ev#985). This resolves elan-ev#985 Haven't added `"array-bracket-spacing": ["error", "always"]` yet. Every useState declaration will look like this: `const [ state, setState ] = useState()` not quite sure, if I like how it looks. I think I will wait for feedback for this rule.
Added more eslint-rules like described in [this issue](#985). This resolves #985 Haven't added `"array-bracket-spacing": ["error", "always"]` yet. Every useState declaration will look like this: `const [ state, setState ] = useState()` not quite sure, if I like how it looks. I think I will wait for feedback for this rule.
In Studio we already use eslint-config with few rules.
To keep the code readable, nice, and consistent, I would like to add a few more rules.
I looked at the eslint rules and picked out a few that I think are useful.
Feedback and further suggestions on the rules are of course welcome.
I would like to implement these rules:
"arrow-spacing": "error"
-> Enforce spacing before and after the arrow in arrow functions
"brace-style": "error"
-> Enforce consistent brace style for blocks
"comma-spacing": ["error", { "before": false, "after": true }]
-> Enforces consistent spacing after commas in variable declarations, array literals, object literals, function parameters, and sequences
"eol-last": ["error", "always"]
-> Enforces that files end with a newline (LF)
"func-call-spacing": ["error", "never"]
-> Disallows spaces between the function name and the opening parenthesis that calls it
"indent": ["error", 2]
-> Enforce consistent indentation
"linebreak-style": ["error", "unix"]
-> Enforce consistent linebreak style
"max-len": ["error", { "code": 120, "ignoreUrls": true }]
-> Enforce a maximum line length
"no-multi-spaces": ["warn", { "ignoreEOLComments": true }]
-> Disallow multiple whitespaces around logical expressions, conditional expressions, declarations, array elements, object properties, sequences and function parameters
"no-trailing-spaces": "error"
-> Disallow trailing whitespace (spaces, tabs, and other Unicode whitespace characters) at the end of lines
"object-curly-spacing": ["error", "always"]
-> Enforce consistent spacing inside braces of object literals, destructuring assignments, and import/export specifiers
"semi": ["error", "always"]
-> Require semicolons at the end of statements
"space-before-function-paren": ["error", "never"]
-> Disallow spacing before function parentheses
"space-infix-ops": "error"
-> Require spacing around operators
I'm not quite sure if these rules are too much:
"array-bracket-spacing": ["error", "always"]
-> Enforces consistent spacing inside array brackets
"arrow-parens": ["error", "as-needed"]
-> Enforces parentheses around arrow function parameters as-needed
"jsx-quotes": ["error", "prefer-double"]
or"jsx-quotes": ["error", "prefer-single"]
-> Enforce the consistent use of either double or single quotes in JSX attributes
The text was updated successfully, but these errors were encountered: