Last active
April 10, 2018 02:59
-
-
Save sigwyg/23134ac4315c10620925ad46ddd72fea to your computer and use it in GitHub Desktop.
PrettierとLinterを併用する ref: https://qiita.com/sigwyg/items/ebb21ef70550cee7a163
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[plugins]] | |
repo = 'sbdchd/neoformat.git' | |
hook_add = ''' | |
"let g:neoformat_verbose = 1 " only affects the verbosity of Neoformat | |
" Enable tab to spaces conversion | |
let g:neoformat_basic_format_retab = 1 | |
" Enable trimmming of trailing whitespace | |
let g:neoformat_basic_format_trim = 1 | |
" js | |
let g:neoformat_javascript_prettiereslint = { | |
\ 'exe': './node_modules/.bin/prettier-eslint', | |
\ 'args': ['--stdin'], | |
\ 'stdin': 1, | |
\ } | |
let g:neoformat_enabled_javascript = ['prettiereslint'] | |
" css | |
let g:neoformat_css_stylelint = { | |
\ 'exe': './node_modules/.bin/stylelint', | |
\ 'args': ['--stdin', '--fix'], | |
\ 'stdin': 1, | |
\ } | |
let g:neoformat_enabled_css = ['stylelint'] | |
augroup fmt | |
autocmd! | |
autocmd BufWritePre *.js Neoformat | |
autocmd BufWritePre *.css Neoformat | |
autocmd BufWritePre *.scss Neoformat | |
augroup END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ yarn add -D prettier | |
$ yarn add -D eslint eslint-plugin-prettier eslint-config-prettier | |
$ yarn add -D eslint-config-standard eslint-plugin-standard eslint-plugin-promise eslint-plugin-import eslint-plugin-node | |
$ yarn add -D stylelint stylelint-order stylelint-config-standard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ eslint --fix src/**/*.js | |
$ stylelint --fix src/**/*.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ yarn add -D lint-staged husky |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ yarn add -D stylelint prettier-stylelint | |
$ yarn add -D stylelint-config-standard stylelint-config-idiomatic-order | |
$ yarn add -D stylefmt | |
$ prettier-stylelint --write src/test.css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`{ "parser": "postcss" }` is deprecated. Prettier now treats it as `{ "parser": "css" }`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
"scripts": { | |
"precommit": "lint-staged" | |
}, | |
"lint-staged": { | |
"src/**/*.{js,json}": [ | |
"eslint --fix", "git add" | |
], | |
"src/**/*.{css,scss}": [ | |
"stylelint --fix", "git add" | |
] | |
}, | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment