Skip to content

Commit

Permalink
fix(lint-staged): enabled prettier-plugin-sh for a lot of files 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Oct 2, 2019
1 parent 1ab9a34 commit 7f74c65
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
12 changes: 10 additions & 2 deletions packages/lint-staged/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ try {
} catch (e) {}

const config = {
'.!(*browserslist|npm|yarn)rc': ['prettier --write', 'git add'],
'*.{js,jsx,md,mdx,mjs,vue}': ['eslint -f friendly --fix', 'git add'],
'*.{gql,html,json,pug,vue,toml,yaml,yml}': ['prettier --write', 'git add'],
'*.{*ignore,*sh,env,gql,html,json,pug,vue,toml,yaml,yml}': [
'prettier --write',
'git add',
],
'.!(*browserslist|npm|yarn)rc': ['prettier --write', 'git add'],
'.{editorconfig|browserslistrc|npmrc|yarnrc}': [
'prettier --write --parser sh',
'git add',
],
Dockerfile: ['prettier --write', 'git add'],
}

if (isStylelintAvailable) {
Expand Down
6 changes: 2 additions & 4 deletions packages/lint-staged/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ const config = Object.assign({}, require('./base'))
let eslint = false

try {
require.resolve('eslint')
eslint = true
eslint = !!require.resolve('eslint')
} catch (e) {}

let tslint

try {
require.resolve(path.resolve('tslint.json'))
tslint = true
tslint = !!require.resolve(path.resolve('tslint.json'))
} catch (e) {}

if (eslint && tslint) {
Expand Down
1 change: 1 addition & 0 deletions packages/lint-staged/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"dependencies": {
"@prettier/plugin-pug": "^1.0.3",
"prettier-plugin-sh": "^0.2.0",
"prettier-plugin-toml": "^0.3.1"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/prettier-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"dependencies": {
"@prettier/plugin-pug": "^1.0.3",
"prettier-plugin-pkg": "^0.4.4",
"prettier-plugin-sh": "^0.1.0",
"prettier-plugin-sh": "^0.2.0",
"prettier-plugin-toml": "^0.3.1"
},
"publishConfig": {
Expand Down
1 change: 1 addition & 0 deletions tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM scratch
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11081,10 +11081,10 @@ prettier-plugin-pkg@^0.4.4:
resolved "https://registry.yarnpkg.com/prettier-plugin-pkg/-/prettier-plugin-pkg-0.4.4.tgz#e7b20cba16995d04fe22b0aa2fe3974d9dc8a757"
integrity sha512-3rIuIjGLoe8tNdG6I1ybAybNxy3O5SgpZsqypxTzPN4hkBtYbGAhBey1ROclKsFpH6SBYny9Y2djXq9y1b+adQ==

prettier-plugin-sh@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/prettier-plugin-sh/-/prettier-plugin-sh-0.1.0.tgz#836be085fd6a83c4570ba04a38964ef7ef6ccbd9"
integrity sha512-eH3nOrCyjxR1SZ2iAjLhogkvGRXvvhZjGcXrqs7hRw5Ijm/nZcdmniDMcnziJgHkRrogltCSw4ori05yFZ9JhQ==
prettier-plugin-sh@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/prettier-plugin-sh/-/prettier-plugin-sh-0.2.0.tgz#9f61d642fa4b20e2bf02cbb94dcfa23dfdbf66e4"
integrity sha512-apDAJO78kpnZ/oJ0NmdiEmd7+gnReomdPKvvucejRG6CUrEezWNB9oNyNIKacm6UuGHs2u9YShVY04sr0UFfVw==
dependencies:
mvdan-sh "^0.4.0"

Expand Down

0 comments on commit 7f74c65

Please sign in to comment.