Closed dmnsgn closed 5 years ago
Can you link description of default prettier rules and config options.
There is stuff that i learned for standard and would need to unlearn like
Space after function name
Um why?
Is the goal "minimum typing"
And stuff that I avoid like fire
Arrow function parentheses (a => b => c anyone?)
In the end i know for 100 devs there is 100 styles and i'll need to learn to live with it. Just like i did with misaligned } else {
... but want to learn first.
Can you link description of default prettier rules and config options.
There is stuff that i learned for standard and would need to unlearn like
All options are here with good explanation why: https://prettier.io/docs/en/options.html
With explicit defaults, these would be our config:
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"arrowParens": "avoid"
}
Space after function name
Not with prettier
Um why?
Because the parenthesis are unnecessary before the ternary.
Is the goal "minimum typing"
Just the result of the bracketSpacing
rule
And stuff that I avoid like fire
Arrow function parentheses (a => b => c anyone?)
Can be forced with arrowParens
option but I usually omit them. Your call.
Linter/formatter config with detailed explanations:
{
"devDependencies": {
"eslint": "^5.15.1",
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-markdown": "^1.0.0",
"eslint-plugin-prettier": "^3.0.1",
"prettier": "1.16.4"
},
// Formatting options
"prettier": {
"semi": false,
"singleQuote": true,
"arrowParens": "always"
},
// Linting options
"eslintConfig": {
"extends": [
"eslint:recommended", // Enable rules from eslint
"plugin:prettier/recommended" // Disable rules clashing with prettier
],
"plugins": [
"prettier", // Make eslint report formatting issues
"markdown" // Lint code blocks in Markdown documents
],
"rules": {
"prettier/prettier": "error" // Tag reported formatting issues as errors (red dot in editors)
},
"parserOptions": {
"ecmaVersion": 2019 // Allows use of the latest js syntax
},
"env": {
"es6": true, // Enable all ECMAScript 6 features except for modules
"browser": true, // Enable use of browser global variables
"node": true // Enable use of Node.js global variables and Node.js scoping
}
}
}
This looks good 👍
Same config as for
pex-renderer
but in pex-context now is probably a good time to review/merge while there's no PR open.