question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Validation Warning: Unknown option ( ... ) was found in the config root.

See original GitHub issue

Description

I have tried every way I can think of to set up the config in package.json and keep getting this warning.

I have tried:

  "lint-staged": {
    "*.{js,jsx}": ["prettier --parser flow --write","git add -f"],
    "*.css": "stylelint",
    "*.scss": "stylelint --syntax=scss"
  }
  "lint-staged": {
    "linters": {
      "*.{js,jsx}": ["prettier --parser flow --write","git add -f"],
      "*.css": "stylelint",
      "*.scss": "stylelint --syntax=scss"
    },
    "ignore": [
      "**/dist/*.min.js"
    ]
  }

and

  "lint-staged": {
    "linters": {
      "*.{js,jsx}": ["prettier --parser flow --write","git add -f"],
      "*.css": "stylelint",
      "*.scss": "stylelint --syntax=scss"
    }
}

all three options throw the same validation warning on pre-commit. What am I doing wrong here?

Debug Logs

expand to view
lint-staged:bin Running `lint-staged@7.2.0` +0ms
  lint-staged Loading config using `cosmiconfig` +0ms
  lint-staged Successfully loaded config from `/Users/.../Documents/_Sarah/projects/.../client/package.json`:
  lint-staged { linters:
  lint-staged    { '*.{js,jsx}': [ 'prettier --parser flow --write', 'git add -f' ],
  lint-staged      '*.css': 'stylelint',
  lint-staged      '*.scss': 'stylelint --syntax=scss' },
  lint-staged   ignore: [ '**/dist/*.min.js' ] } +8ms
  lint-staged:cfg Normalizing config +0ms
  lint-staged:cfg Validating config +1ms
● Validation Warning:

  Unknown option "*.{js,jsx}" with value ['prettier --parser flow --write', 'git add -f'] was found in the config root.

  You are probably trying to mix simple and advanced config formats. Adding

  "linters": {
    "*.{js,jsx}": ["prettier --parser flow --write","git add -f"]
  }

  will fix it and remove this message.

Please refer to https://github.com/okonet/lint-staged#configuration for more information...
● Validation Warning:

  Unknown option "*.scss" with value 'stylelint --syntax=scss' was found in the config root.

  You are probably trying to mix simple and advanced config formats. Adding

  "linters": {
    "*.scss": "stylelint --syntax=scss"
  }

  will fix it and remove this message.

Please refer to https://github.com/okonet/lint-staged#configuration for more information...
Running lint-staged with the following config:
{
  linters: {
    '*.{js,jsx}': [
      'prettier --parser flow --write',
      'git add -f'
    ],
    '*.css': 'stylelint',
    '*.scss': 'stylelint --syntax=scss'
  },
  ignore: [
    '**/dist/*.min.js'
  ],
  concurrent: true,
  chunkSize: 9007199254740991,
  globOptions: {
    matchBase: true,
    dot: true
  },
  subTaskConcurrency: 1,
  renderer: 'verbose'
}
  lint-staged:run Running all linter scripts +0ms
  lint-staged:run Resolved git directory to be `/Users/.../Documents/_Sarah/projects/.../` +1ms
  lint-staged:run Loaded list of staged files in git:
  lint-staged:run [ 'client/src/styles/scss/index.scss',
  lint-staged:run   'client/src/styles/css/index.css.map',
  lint-staged:run   'client/src/styles/css/index.css',
  lint-staged:run   'client/src/App.js',
  lint-staged:run   'client/.sass-cache/b7749e0937e10bf69c9e583c019129b16433a3b7/index.scssc' ] +56ms
  lint-staged:gen-tasks Generating linter tasks +0ms
  lint-staged:cfg Normalizing config +64ms
  lint-staged:gen-tasks Generated task: 
  lint-staged:gen-tasks { pattern: '*.{js,jsx}',
  lint-staged:gen-tasks   commands: [ 'prettier --parser flow --write', 'git add -f' ],
  lint-staged:gen-tasks   fileList:
  lint-staged:gen-tasks    [ '/Users/.../Documents/_Sarah/projects/.../client/src/App.js' ] } +21ms
  lint-staged:gen-tasks Generated task: 
  lint-staged:gen-tasks { pattern: '*.css',
  lint-staged:gen-tasks   commands: 'stylelint',
  lint-staged:gen-tasks   fileList:
  lint-staged:gen-tasks    [ '/Users/.../Documents/_Sarah/projects/.../client/src/styles/css/index.css' ] } +1ms
  lint-staged:gen-tasks Generated task: 
  lint-staged:gen-tasks { pattern: '*.scss',
  lint-staged:gen-tasks   commands: 'stylelint --syntax=scss',
  lint-staged:gen-tasks   fileList:
  lint-staged:gen-tasks    [ '/Users/.../Documents/_Sarah/projects/.../client/src/styles/scss/index.scss' ] } +1ms
Running tasks for *.{js,jsx} [started]
Running tasks for *.css [started]
Running tasks for *.scss [started]
  lint-staged:make-cmd-tasks Creating listr tasks for commands [ 'prettier --parser flow --write', 'git add -f' ] +0ms
  lint-staged:find-bin Resolving binary for command `prettier --parser flow --write` +0ms
  lint-staged:find-bin Binary for `prettier --parser flow --write` resolved to `/Users/.../Documents/_Sarah/projects/.../client/node_modules/.bin/prettier` +3ms
  lint-staged:task ✔  OS: darwin; File path chunking unnecessary +0ms
  lint-staged:find-bin Resolving binary for command `git add -f` +0ms
  lint-staged:find-bin Binary for `git add -f` resolved to `/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git` +1ms
  lint-staged:task ✔  OS: darwin; File path chunking unnecessary +1ms
  lint-staged:make-cmd-tasks Creating listr tasks for commands 'stylelint' +5ms
  lint-staged:find-bin Resolving binary for command `stylelint` +1ms
  lint-staged:find-bin Binary for `stylelint` resolved to `/Users/.../Documents/_Sarah/projects/.../client/node_modules/.bin/stylelint` +1ms
  lint-staged:task ✔  OS: darwin; File path chunking unnecessary +2ms
  lint-staged:make-cmd-tasks Creating listr tasks for commands 'stylelint --syntax=scss' +2ms
  lint-staged:find-bin Resolving binary for command `stylelint --syntax=scss` +1ms
  lint-staged:find-bin Resolving binary for `stylelint` from cache +0ms
  lint-staged:task ✔  OS: darwin; File path chunking unnecessary +1ms
prettier --parser flow --write [started]
stylelint [started]
stylelint --syntax=scss [started]
  lint-staged:task bin: /Users/.../Documents/_Sarah/projects/.../client/node_modules/.bin/prettier +0ms
  lint-staged:task args: [ '--parser',
  lint-staged:task   'flow',
  lint-staged:task   '--write',
  lint-staged:task   '/Users/.../Documents/_Sarah/projects/.../client/src/App.js' ] +0ms
  lint-staged:task opts: { reject: false } +0ms
  lint-staged:task bin: /Users/.../Documents/_Sarah/projects/.../client/node_modules/.bin/stylelint +13ms
  lint-staged:task args: [ '/Users/.../Documents/_Sarah/projects/.../client/src/styles/css/index.css' ] +0ms
  lint-staged:task opts: { reject: false } +1ms
  lint-staged:task bin: /Users/.../Documents/_Sarah/projects/.../client/node_modules/.bin/stylelint +4ms
  lint-staged:task args: [ '--syntax=scss',
  lint-staged:task   '/Users/.../Documents/_Sarah/projects/.../client/src/styles/scss/index.scss' ] +0ms
  lint-staged:task opts: { reject: false } +0ms
prettier --parser flow --write [completed]
git add -f [started]
  lint-staged:task bin: /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git +540ms
  lint-staged:task args: [ 'add',
  lint-staged:task   '-f',
  lint-staged:task   '/Users/.../Documents/_Sarah/projects/.../client/src/App.js' ] +0ms
  lint-staged:task opts: { reject: false, cwd: '/Users/.../Documents/_Sarah/projects/.../' } +0ms
git add -f [completed]
Running tasks for *.{js,jsx} [completed]
stylelint [failed]
→ 
Running tasks for *.css [failed]
→ 
stylelint --syntax=scss [failed]
→ 
Running tasks for *.scss [failed]
→ 
✖ "stylelint" found some errors. Please fix them and try committing again.
Error: No configuration provided for /Users/.../Documents/_Sarah/projects/.../client/src/styles/css/index.css
at module.exports (/Users/.../Documents/_Sarah/projects/.../client/node_modules/stylelint/lib/utils/configurationError.js:8:28)
at searchForConfig.then.then.config (/Users/.../Documents/_Sarah/projects/.../client/node_modules/stylelint/lib/getConfigForFile.js:49:15)
✖ "stylelint --syntax=scss" found some errors. Please fix them and try committing again.
Error: No configuration provided for /Users/.../Documents/_Sarah/projects/.../client/src/styles/scss/index.scss
at module.exports (/Users/.../Documents/_Sarah/projects/.../client/node_modules/stylelint/lib/utils/configurationError.js:8:28)
at searchForConfig.then.then.config (/Users/.../Documents/_Sarah/projects/.../client/node_modules/stylelint/lib/getConfigForFile.js:49:15)

husky > pre-commit hook failed (add --no-verify to bypass)
...:client ...$ 

Environment

  • OS: macOS High Sierra
  • Node.js: 10.8.0
  • lint-staged: 7.2.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:16
  • Comments:18 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
jmerlecommented, Aug 11, 2018

Same issue, the bug seems to have appeared in 3d0ccb2. I got rid of the warning by pinning lint-staged to version 7.1.2 (yarn add -D lint-staged@7.1.2), which doesn’t have the issue.

4reactions
Abdisalancommented, Oct 22, 2018

What fixed it was upgrading to 7.3.0, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incorrect version of jest trying to run jest - Stack Overflow
I had the same issue, after a long search I've tried this: type jest. Which gave me the location: /usr/local/bin/jest.
Read more >
node_modules/jest-validate · feature-navigation - GitLab
Validation Warning: Unknown option transformx with value "<rootDir>/node_modules/babel-jest" was found. This is either a typing error or a user mistake.
Read more >
jest-validate | Yarn - Package Manager
Generic configuration validation tool that helps you with warnings, errors and deprecation messages as well as showing users examples of correct configuration.
Read more >
Options - TypeDoc
Any options passed on the command line will override options set in a ... are the root of an npm Workspace or a...
Read more >
User and Workspace Settings - Visual Studio Code
Note: For a Multi-root Workspace, workspace settings are located inside the workspace configuration file. When you add a Workspace Settings settings.json ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found