Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lint-staged/lint-staged
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v8.0.3
Choose a base ref
...
head repository: lint-staged/lint-staged
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v8.0.4
Choose a head ref
  • 6 commits
  • 6 files changed
  • 4 contributors

Commits on Oct 29, 2018

  1. Verified

    This commit was signed with the committer’s verified signature.
    ssbarnea Sorin Sbarnea
    Copy the full SHA
    ce434d3 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    ssbarnea Sorin Sbarnea
    Copy the full SHA
    c4e8a2d View commit details

Commits on Oct 30, 2018

  1. refactor: Use object spread (#524)

    Closes #508
    nadavkaner authored and okonet committed Oct 30, 2018
    Copy the full SHA
    bedba5a View commit details
  2. docs: fix typo (#527)

    Justkant authored and okonet committed Oct 30, 2018
    Copy the full SHA
    00047de View commit details
  3. Copy the full SHA
    07fd087 View commit details

Commits on Oct 31, 2018

  1. Merge pull request #513 from okonet/greenkeeper/staged-git-files-1.1.2

    Update staged-git-files to the latest version 🚀
    okonet authored Oct 31, 2018
    Copy the full SHA
    5e165a3 View commit details
Showing with 10 additions and 760 deletions.
  1. +1 −1 README.md
  2. +1 −1 package.json
  3. +3 −2 src/getConfig.js
  4. +1 −1 src/resolveTaskFn.js
  5. +1 −1 test/generateTasks.spec.js
  6. +3 −754 yarn.lock
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -207,7 +207,7 @@ Tools like [Prettier](https://prettier.io), ESLint/TSLint, or stylefmt can refor
}
```

Starting from v8, lint-staged will stash you remaining changes (not added to the index) and restore them from stash afterwards if there are partially staged files detected. This allows you to create partial commits with hunks using `git add --patch`. See the [blog post](https://medium.com/@okonetchnikov/announcing-lint-staged-with-support-for-partially-staged-files-abc24a40d3ff)
Starting from v8, lint-staged will stash your remaining changes (not added to the index) and restore them from stash afterwards if there are partially staged files detected. This allows you to create partial commits with hunks using `git add --patch`. See the [blog post](https://medium.com/@okonetchnikov/announcing-lint-staged-with-support-for-partially-staged-files-abc24a40d3ff)

## Examples

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@
"path-is-inside": "^1.0.2",
"pify": "^3.0.0",
"please-upgrade-node": "^3.0.2",
"staged-git-files": "1.1.1",
"staged-git-files": "1.1.2",
"string-argv": "^0.0.2",
"stringify-object": "^3.2.2"
},
5 changes: 3 additions & 2 deletions src/getConfig.js
Original file line number Diff line number Diff line change
@@ -121,12 +121,13 @@ const optRmMsg = (opt, helpMsg) => ` Option ${chalk.bold(opt)} was removed.
*/
function validateConfig(config) {
debug('Validating config')
const exampleConfig = Object.assign({}, defaultConfig, {
const exampleConfig = {
...defaultConfig,
linters: {
'*.js': ['eslint --fix', 'git add'],
'*.css': 'stylelint'
}
})
}

const deprecatedConfig = {
gitDir: () => optRmMsg('gitDir', "lint-staged now automatically resolves '.git' directory."),
2 changes: 1 addition & 1 deletion src/resolveTaskFn.js
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ function execLinter(bin, args, execaOptions, pathsToLint) {
debug('args: %O', binArgs)
debug('opts: %o', execaOptions)

return execa(bin, binArgs, Object.assign({}, execaOptions))
return execa(bin, binArgs, { ...execaOptions })
}

const successMsg = linter => `${symbols.success} ${linter} passed!`
2 changes: 1 addition & 1 deletion test/generateTasks.spec.js
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ describe('generateTasks', () => {
it('should not match non-children files', () => {
const relPath = path.join(process.cwd(), '..')
resolveGitDir.mockReturnValueOnce(relPath)
const result = generateTasks(Object.assign({}, config), files)
const result = generateTasks({ ...config }, files)
const linter = result.find(item => item.pattern === '*.js')
expect(linter).toEqual({
pattern: '*.js',
757 changes: 3 additions & 754 deletions yarn.lock

Large diffs are not rendered by default.