Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deps): bump lint-staged from 14.0.1 to 15.1.0 #1652

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Nov 13, 2023

Bumps lint-staged from 14.0.1 to 15.1.0.

Release notes

Sourced from lint-staged's releases.

v15.1.0

Minor Changes

  • #1344 0423311 Thanks @​danielbayley! - Add support for loading configuration from package.yaml and package.yml files, supported by pnpm.

Patch Changes

v15.0.2

Patch Changes

  • #1339 8e82364 Thanks @​iiroj! - Update dependencies, including listr2@7.0.2 to fix an upstream issue affecting lint-staged.

v15.0.1

Patch Changes

  • #1217 d2e6f8b Thanks @​louneskmt! - Previously it was possible for a function task to mutate the list of staged files passed to the function, and accidentally affect the generation of other tasks. This is now fixed by passing a copy of the original file list instead.

v15.0.0

Major Changes

  • #1322 66b93aa Thanks @​iiroj! - Require at least Node.js 18.12.0

    This release drops support for Node.js 16, which is EOL after 2023-09-11. Please upgrade your Node.js to the latest version.

    Additionally, all dependencies have been updated to their latest versions.

Changelog

Sourced from lint-staged's changelog.

15.1.0

Minor Changes

  • #1344 0423311 Thanks @​danielbayley! - Add support for loading configuration from package.yaml and package.yml files, supported by pnpm.

Patch Changes

15.0.2

Patch Changes

  • #1339 8e82364 Thanks @​iiroj! - Update dependencies, including listr2@7.0.2 to fix an upstream issue affecting lint-staged.

15.0.1

Patch Changes

  • #1217 d2e6f8b Thanks @​louneskmt! - Previously it was possible for a function task to mutate the list of staged files passed to the function, and accidentally affect the generation of other tasks. This is now fixed by passing a copy of the original file list instead.

15.0.0

Major Changes

  • #1322 66b93aa Thanks @​iiroj! - Require at least Node.js 18.12.0

    This release drops support for Node.js 16, which is EOL after 2023-09-11. Please upgrade your Node.js to the latest version.

    Additionally, all dependencies have been updated to their latest versions.

Commits
  • 26eee9d chore(changeset): release
  • fed0770 docs: update README to mention v13.3.0
  • 70487af test: add unit test for uncovered error
  • 0423311 docs: add changeset
  • 19fe984 refactor: declare some variables
  • 0ac8e91 feat: add support for package.yaml
  • e023c2a test: add integration test for symbolic link git dir
  • 4b9fb10 chore(deps): update dependencies
  • 105d901 fix: suppress warnings when using --quiet
  • 21aeeb5 chore(deps): update dependencies
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore <dependency name> major version will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
  • @dependabot ignore <dependency name> minor version will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
  • @dependabot ignore <dependency name> will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
  • @dependabot unignore <dependency name> will remove all of the ignore conditions of the specified dependency
  • @dependabot unignore <dependency name> <ignore condition> will remove the ignore condition of the specified dependency and ignore conditions

@dependabot dependabot bot added dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code labels Nov 13, 2023
Copy link
Contributor

Diff between lint-staged 14.0.1 and 15.1.0
diff --git a/bin/lint-staged.js b/bin/lint-staged.js
index v14.0.1..v15.1.0 100755
--- a/bin/lint-staged.js
+++ b/bin/lint-staged.js
@@ -16,4 +16,6 @@
 }
 
+const debugLog = debug('lint-staged:bin')
+
 // Do not terminate main Listr process on SIGINT
 process.on('SIGINT', () => {})
@@ -22,7 +24,4 @@
 const version = packageJson.version
 
-const debugLog = debug('lint-staged:bin')
-debugLog('Running `lint-staged@%s`', version)
-
 const cli = program.version(version)
 
@@ -91,4 +90,6 @@
 }
 
+debugLog('Running `lint-staged@%s` on Node.js %s (%s)', version, process.version, process.platform)
+
 const options = {
   allowEmpty: !!cliOptions.allowEmpty,
diff --git a/lib/loadConfig.js b/lib/loadConfig.js
index v14.0.1..v15.1.0 100644
--- a/lib/loadConfig.js
+++ b/lib/loadConfig.js
@@ -1,4 +1,6 @@
 /** @typedef {import('./index').Logger} Logger */
 
+import path from 'node:path'
+
 import debug from 'debug'
 import { lilconfig } from 'lilconfig'
@@ -10,6 +12,10 @@
 const debugLog = debug('lint-staged:loadConfig')
 
-const PACKAGE_JSON = 'package.json'
+const CONFIG_NAME = 'lint-staged'
 
+const PACKAGE_JSON_FILE = 'package.json'
+
+const PACKAGE_YAML_FILES = ['package.yaml', 'package.yml']
+
 /**
  * The list of files `lint-staged` will read configuration
@@ -17,5 +23,6 @@
  */
 export const searchPlaces = [
-  PACKAGE_JSON,
+  PACKAGE_JSON_FILE,
+  ...PACKAGE_YAML_FILES,
   '.lintstagedrc',
   '.lintstagedrc.json',
@@ -30,10 +37,10 @@
 ]
 
-const jsonParse = (path, content) => {
+const jsonParse = (filePath, content) => {
   try {
     return JSON.parse(content)
   } catch (error) {
-    if (path.endsWith(PACKAGE_JSON)) {
-      debugLog('Ignoring invalid package file `%s` with content:\n%s', path, content)
+    if (path.basename(filePath) === PACKAGE_JSON_FILE) {
+      debugLog('Ignoring invalid package file `%s` with content:\n%s', filePath, content)
       return undefined
     }
@@ -43,6 +50,19 @@
 }
 
-const yamlParse = (path, content) => YAML.parse(content)
+const yamlParse = (filePath, content) => {
+  const isPackageFile = PACKAGE_YAML_FILES.includes(path.basename(filePath))
+  try {
+    const yaml = YAML.parse(content)
+    return isPackageFile ? yaml[CONFIG_NAME] : yaml
+  } catch (error) {
+    if (isPackageFile) {
+      debugLog('Ignoring invalid package file `%s` with content:\n%s', filePath, content)
+      return undefined
+    }
 
+    throw error
+  }
+}
+
 /**
  * `lilconfig` doesn't support yaml files by default,
@@ -61,5 +81,5 @@
 }
 
-const explorer = lilconfig('lint-staged', { searchPlaces, loaders })
+const explorer = lilconfig(CONFIG_NAME, { searchPlaces, loaders })
 
 /**
diff --git a/lib/makeCmdTasks.js b/lib/makeCmdTasks.js
index v14.0.1..v15.1.0 100644
--- a/lib/makeCmdTasks.js
+++ b/lib/makeCmdTasks.js
@@ -25,6 +25,8 @@
     // command function may return array of commands that already include `stagedFiles`
     const isFn = typeof cmd === 'function'
-    const resolved = isFn ? await cmd(files) : cmd
 
+    /** Pass copy of file list to prevent mutation by function from config file. */
+    const resolved = isFn ? await cmd([...files]) : cmd
+
     const resolvedArray = Array.isArray(resolved) ? resolved : [resolved] // Wrap non-array command as array
 
diff --git a/lib/runAll.js b/lib/runAll.js
index v14.0.1..v15.1.0 100644
--- a/lib/runAll.js
+++ b/lib/runAll.js
@@ -109,5 +109,5 @@
   // and when using the default list of staged files by default
   ctx.shouldBackup = hasInitialCommit && stash
-  if (!ctx.shouldBackup) {
+  if (!ctx.shouldBackup && !quiet) {
     logger.warn(skippingBackup(hasInitialCommit, diff))
   }
@@ -243,5 +243,5 @@
   }
 
-  if (hasDeprecatedGitAdd) {
+  if (hasDeprecatedGitAdd && !quiet) {
     logger.warn(DEPRECATED_GIT_ADD)
   }
@@ -284,5 +284,5 @@
       },
       {
-        title: `Running tasks for staged files...`,
+        title: `Running tasks for ${diff ? 'changed' : 'staged'} files...`,
         task: (ctx, task) => task.newListr(listrTasks, { concurrent }),
         skip: () => listrTasks.every((task) => task.skip()),
diff --git a/package.json b/package.json
index v14.0.1..v15.1.0 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
 {
   "name": "lint-staged",
-  "version": "14.0.1",
+  "version": "15.1.0",
   "description": "Lint files staged by git",
   "license": "MIT",
@@ -15,5 +15,5 @@
   },
   "engines": {
-    "node": "^16.14.0 || >=18.0.0"
+    "node": ">=18.12.0"
   },
   "type": "module",
@@ -31,35 +31,42 @@
     "lint": "eslint .",
     "test": "jest --coverage",
-    "test:watch": "jest --watch"
+    "test:watch": "jest --watch",
+    "version": "npx changeset version",
+    "postversion": "npm i --package-lock-only && git commit -am \"chore(changeset): release\"",
+    "tag": "npx changeset tag"
   },
   "dependencies": {
     "chalk": "5.3.0",
-    "commander": "11.0.0",
+    "commander": "11.1.0",
     "debug": "4.3.4",
-    "execa": "7.2.0",
+    "execa": "8.0.1",
     "lilconfig": "2.1.0",
-    "listr2": "6.6.1",
+    "listr2": "7.0.2",
     "micromatch": "4.0.5",
     "pidtree": "0.6.0",
     "string-argv": "0.3.2",
-    "yaml": "2.3.1"
+    "yaml": "2.3.4"
   },
   "devDependencies": {
-    "@babel/core": "7.22.10",
-    "@babel/eslint-parser": "7.22.10",
-    "@babel/preset-env": "7.22.10",
-    "babel-jest": "29.6.2",
+    "@babel/core": "7.23.3",
+    "@babel/eslint-parser": "7.23.3",
+    "@babel/preset-env": "7.23.3",
+    "@changesets/changelog-github": "0.4.8",
+    "@changesets/cli": "2.26.2",
+    "@commitlint/cli": "18.4.0",
+    "@commitlint/config-conventional": "18.4.0",
+    "babel-jest": "29.7.0",
     "babel-plugin-transform-imports": "2.0.0",
     "consolemock": "1.1.0",
-    "eslint": "8.46.0",
+    "eslint": "8.53.0",
     "eslint-config-prettier": "9.0.0",
-    "eslint-plugin-import": "2.28.0",
+    "eslint-plugin-import": "2.29.0",
     "eslint-plugin-node": "11.1.0",
-    "eslint-plugin-prettier": "5.0.0",
+    "eslint-plugin-prettier": "5.0.1",
     "husky": "8.0.3",
-    "jest": "29.6.2",
+    "jest": "29.7.0",
     "jest-snapshot-serializer-ansi": "2.1.0",
     "mock-stdin": "1.0.0",
-    "prettier": "3.0.1"
+    "prettier": "3.0.3"
   },
   "keywords": [
diff --git a/README.md b/README.md
index v14.0.1..v15.1.0 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,3 @@
-# 🚫💩 lint-staged ![GitHub Actions](https://github.com/okonet/lint-staged/workflows/CI/badge.svg) [![npm version](https://badge.fury.io/js/lint-staged.svg)](https://badge.fury.io/js/lint-staged) [![Codecov](https://codecov.io/gh/okonet/lint-staged/branch/master/graph/badge.svg)](https://codecov.io/gh/okonet/lint-staged)
+# 🚫💩 lint-staged [![Test & Release](https://github.com/okonet/lint-staged/actions/workflows/push.yml/badge.svg)](https://github.com/okonet/lint-staged/actions/workflows/push.yml) [![Publish](https://github.com/okonet/lint-staged/actions/workflows/tag.yml/badge.svg)](https://github.com/okonet/lint-staged/actions/workflows/tag.yml) [![npm version](https://badge.fury.io/js/lint-staged.svg)](https://badge.fury.io/js/lint-staged) [![Codecov](https://codecov.io/gh/okonet/lint-staged/branch/master/graph/badge.svg)](https://codecov.io/gh/okonet/lint-staged)
 
 Run linters against staged git files and don't let :poop: slip into your code base!
@@ -73,4 +73,8 @@
 ### Migration
 
+#### v15
+
+- Since `v15.0.0` _lint-staged_ no longer supports Node.js 16. Please upgrade your Node.js version to at least `18.12.0`.
+
 #### v14
 
@@ -80,4 +84,5 @@
 
 - Since `v13.0.0` _lint-staged_ no longer supports Node.js 12. Please upgrade your Node.js version to at least `14.13.1`, or `16.0.0` onward.
+- Version `v13.3.0` was incorrectly released including code of version `v14.0.0`. This means the breaking changes of `v14` are also included in `v13.3.0`, the last `v13` version released
 
 #### v12
@@ -146,5 +151,5 @@
 _Lint-staged_ can be configured in many ways:
 
-- `lint-staged` object in your `package.json`
+- `lint-staged` object in your `package.json`, or [`package.yaml`](https://github.com/pnpm/pnpm/pull/1799)
 - `.lintstagedrc` file in JSON or YML format, or you can be explicit with the file extension:
   - `.lintstagedrc.json`
@@ -907,3 +912,20 @@
 </details>
 
+#### ESLint >= 8.51.0 && [Flat ESLint config](https://eslint.org/docs/latest/use/configure/configuration-files-new)
+
+<details>
+  <summary>Click to expand</summary>
+
+ESLint v8.51.0 introduced [`--no-warn-ignored` CLI flag](https://eslint.org/docs/latest/use/command-line-interface#--no-warn-ignored). It suppresses the `warning File ignored because of a matching ignore pattern. Use "--no-ignore" to override` warning, so manually ignoring files via `eslint.isPathIgnored` is no longer necessary.
+
+```json
+{
+  "*.js": "eslint --max-warnings=0 --no-warn-ignored"
+}
+```
+
+**NOTE:** `--no-warn-ignored` flag is only available when [Flat ESLint config](https://eslint.org/docs/latest/use/configure/configuration-files-new) is used.
+
 </details>
+
+</details>
Size Files
111.1 KB → 113.4 KB (+2.3 KB 🟡) 33 → 33 (±0 🟢)
Command details
npm diff --diff=lint-staged@14.0.1 --diff=lint-staged@15.1.0 --diff-unified=2

See also the npm diff document.

Reported by ybiquitous/npm-diff-action@v1.5.0 (Node.js 20.9.0 and npm 10.2.3)

@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/lint-staged-15.1.0 branch 4 times, most recently from b336914 to c0572f2 Compare November 20, 2023 03:07
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/lint-staged-15.1.0 branch 3 times, most recently from d9cc46e to 42ebfac Compare November 27, 2023 03:09
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/lint-staged-15.1.0 branch from 42ebfac to 9a38b7c Compare November 27, 2023 03:13
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 14.0.1 to 15.1.0.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Changelog](https://github.com/lint-staged/lint-staged/blob/master/CHANGELOG.md)
- [Commits](lint-staged/lint-staged@v14.0.1...v15.1.0)

---
updated-dependencies:
- dependency-name: lint-staged
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/npm_and_yarn/lint-staged-15.1.0 branch from 9a38b7c to 6e5777e Compare November 27, 2023 03:26
@ybiquitous ybiquitous changed the title build(deps): bump lint-staged from 14.0.1 to 15.1.0 feat(deps): bump lint-staged from 14.0.1 to 15.1.0 Nov 27, 2023
@ybiquitous ybiquitous merged commit da3a382 into main Nov 27, 2023
4 checks passed
@ybiquitous ybiquitous deleted the dependabot/npm_and_yarn/lint-staged-15.1.0 branch November 27, 2023 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant