Prettier
Prettier Integration with ESLint/TSLint/Typescript
To install package
npm i -g prettier-config-uxp
or
npm i prettier-config-uxp --save
After Installation
prettier-config-uxp --init
or
node_module/.bin/prettier-config-uxp
or via npx:
npx prettier-config-uxp
Steps
After installation user will be prompted if they are using TSLINT, ESLINT or VanillaJs.
ESLint
After selecting ESLINT user will be prompted for typescrpt usage
Is Typescript Exist? (y/n)
Option 1:
'y'
. ESLINT with Typescript. Following dependencies will be added to your package.json.
a) ESLint
b) ESLint-Config-Prettier
: ESLint Prettier Mixin.
c) eslint-config-reacts-lint
: ESLint Rules Set.
d) ESLint-Plugin-Import
: ESLint Plugin for Import/Expor and ES6+ syntax.
e) ESLint-Plugin-Prettier
: ESLint Prettier Plugin.
Overide Default Configuration
Within .eslintrc.js
add or remove rules like below:
"rules": {
'@typescript-eslint/indent': [2, 2]
}
Option 2:
'n'
. ESLint with JSX. Following dependencies will be added to your package.json.
a) ESLint
b) ESLint-Config-Prettier
: ESLint Prettier Mixin.
c)eslint-config-angular-lint
: ESLint Rules Set.
d) ESLint-Plugin-Import
: ESLint Plugin for Import/Expor and ES6+ syntax.
e) ESLint-Plugin-Prettier
: ESLint Prettier Plugin.
Overide Default Configuration
Within .eslintrc.js
add or remove rules like below:
"rules": {
"semi": [0, "never"],
"quotes":[ 1, "single", "avoid-escape"]
}
TSLint
After selecting TSLint following dependencies will be added to your package.json.
a) TSLint
b) TSLint-Plugin-Prettier
: TSLint Prettier Plugin.
Overide Default Configuration
Within tslint.json
add or remove rules like below:
"rules": {
"semi": [0, "never"],
"quotes":[ 1, "single", "avoid-escape"]
}
Vanillajs
Overide Default Configuration
Within .eslintrc.js
add or remove rules like below:
"module.exports"= {
...require('@prettier-config-uxp'),
semi: false
}
Uninstall
If installed via npx:
prettier-config-uxp remove
or
node_module/.bin/prettier-config-uxp remove