You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recommend trainees use Prettier, and it's included in our extension pack. However, when it's used with this ESLint configuration, there are various conflicts that cause a bunch of errors to appear.
For example, the default in Prettier is to indent with two spaces, rather than tabs (although this is configurable with useTabs: true in a .prettierrc or one of the other options).
In general, Prettier wants to be doing all of the style stuff and leave linters to finding possible errors (see https://prettier.io/docs/en/comparison.html). There's an ESLint config available that just turns off a bunch of rules, including most set here (everything except no-unused-vars ,no-var), to avoid conflicts.
One of the conflicts can be avoided with a tweak to this configuration:
We recommend trainees use Prettier, and it's included in our extension pack. However, when it's used with this ESLint configuration, there are various conflicts that cause a bunch of errors to appear.
For example, the default in Prettier is to indent with two spaces, rather than tabs (although this is configurable with
useTabs: truein a.prettierrcor one of the other options).In general, Prettier wants to be doing all of the style stuff and leave linters to finding possible errors (see https://prettier.io/docs/en/comparison.html). There's an ESLint config available that just turns off a bunch of rules, including most set here (everything except
no-unused-vars,no-var), to avoid conflicts.One of the conflicts can be avoided with a tweak to this configuration:
but
indentandoperator-linebreakwill still conflict:Rule summary:
arrow-parens: no conflict, can explicitly setarrowParens: "always"in.prettierrcbrace-style: no conflictcomma-dangle: no conflict, can explicitly settrailingComma: "es5"in.prettierrccurly: no conflict with the default"all"config per https://github.com/prettier/eslint-config-prettier#curlyindent: conflict, we can ask Prettier to use tabs withuseTabs: truein.prettierrcbut it will still use spaces for alignment, ESLint and Prettier take fundamentally different approaches here (see e.g. eslint and prettier clash over aligning long a ? b : c statement with 4 space tabs eslint/eslint#10930 (comment))linebreak-style: no conflict, can explicitly setendOfLine: "lf"in.prettierrcno-trailing-spaces: no conflictno-unused-vars: not a style ruleno-var: not a style ruleobject-curly-spacing: no conflict, can explicitly setbracketSpacing: truein.prettierrcoperator-linebreak: conflict Prettier will put some operators at the end of the line (see discussion at Placing operators at the beginning of lines prettier/prettier#3806)quotes: needs update to these rules, toavoidEscapeand notallowTemplateLiterals, can explicitly setsingleQuote: falsein.prettierrcsemi: no conflict, can explicitly setsemi: truein.prettierrcAn explicit
.prettierrcfor all of these changes would look like:For folks using this style with Prettier, do we recommend they override the two conflicting rules?
{ "extends": [ "@codeyourfuture/standard" ], "rules": { "indent": "off", "operator-linebreak": "off" } }Or remove them from this styling entirely?