0.2.4 • Published 5 years ago
@studyworld/code v0.2.4
@studyworld/code
Набор конфигов для prettier и eslint
Как использовать
npm i --save-dev @studyworld/codepackage.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/prettieror.bin\prettier.cmdin the project’snode_modulefolder. Or, if Prettier is installed globally, selectprettieron macOS and Linux orC:\Users\user_name\AppData\Roaming\npm\prettier.cmdon Windows (or whatevernpm prefix -greturns). - 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!