Linter running on unstaged files during commit — is this expected?

Hey everyone,

I’m encountering a linting issue during commits and wanted to get some clarity.
I modified my gatsby-node.js file to generate specific pages, but I haven’t staged that file for commit yet. However, when I run git commit, the linter runs on the entire repository — including the unstaged gatsby-node.js file.

Is this expected behavior? Shouldn’t the linter only run on the files I’ve actually staged for commit?

Any insights or suggestions would be really appreciated! Thanks in advance.

$ git commit -s -m"fix dark mode button text issue"

> Layer5@1.0.0 checklint
> eslint .

Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme

C:\Users\ashoka\Desktop\contribute or look out\layer5\gatsby-node.js
    10:9   warning  'paginate' is assigned a value but never used. Allowed unused vars must match /React/u                  no-unused-vars
    14:3   warning  'componentsData' is assigned a value but never used. Allowed unused vars must match /React/u            no-unused-vars
    44:39  error    A space is required before '}'                                                                          object-curly-spacing
   979:7   warning  'createCoursesListPage' is assigned a value but never used. Allowed unused vars must match /React/u     no-unused-vars
   995:7   warning  'createCourseOverviewPage' is assigned a value but never used. Allowed unused vars must match /React/u  no-unused-vars
  1012:7   warning  'createChapterPage' is assigned a value but never used. Allowed unused vars must match /React/u         no-unused-vars
  1031:7   warning  'createSectionPage' is assigned a value but never used. Allowed unused vars must match /React/u         no-unused-vars

✖ 7 problems (1 error, 6 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

husky - pre-commit hook exited with code 1 (error)