@studyworld/code
v0.2.4
Published
Набор конфигов для `prettier` и `eslint`
Downloads
20
Keywords
Readme
@studyworld/code
Набор конфигов для prettier
и eslint
Как использовать
npm i --save-dev @studyworld/code
package.json
{
// ...
"prettier": "@studyworld/code/prettier",
"eslintConfig": {
"extends": "./node_modules/@studyworld/code/eslint"
},
// ...
}
Prettier
WebStorm
Go to Preferences | Tools | File Watchers and click + to add a new watcher.
In Webstorm 2018.2, select Prettier from the list, review the configuration, add any additional arguments if needed, and click OK.
In older IDE versions, select Custom and do the following configuration:
- Name: Prettier or any other name
- File Type: JavaScript (or Any if you want to run Prettier on all files)
- Scope: Project Files
- Program: full path to
.bin/prettier
or.bin\prettier.cmd
in the project’snode_module
folder. Or, if Prettier is installed globally, selectprettier
on macOS and Linux orC:\Users\user_name\AppData\Roaming\npm\prettier.cmd
on Windows (or whatevernpm prefix -g
returns). - Arguments:
--write $FilePath$
- Output paths to refresh:
$FilePathRelativeToProjectRoot$
- Working directory:
$ProjectFileDir$
- Auto-save edited files to trigger the watcher: Uncheck to reformat on Save only.
ESLint
WebStorm
- In the Settings/Preferences dialog go to Languages and Frameworks | JavaScript | Code Quality Tools | ESLint.
- Select Automatic ESLint configuration.
VS Code
- Install ESLint plugin from the extensions marketplace
- Enjoy!