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 "*.js" with value XXX was found in the config root.

See original GitHub issue

Description

I get this error on precommit hook: ● Validation Warning:

Unknown option “*.js” with value [‘prettier-eslint --write’, ‘git add’] was found in the config root.

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

“linters”: { “*.js”: [“prettier-eslint --write”,“git add”] }

will fix it and remove this message.

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

It seems that in the last version 7.2.0 the configuration options changed: from

  "lint-staged": {
      "*.{js,scss}": [
        "prettier-eslint --write",
        "git add"
      ]
    "ignore": [
      "**/src/scripts/*.min.js"
    ]
  },

to

  "lint-staged": {
    "linters": {
      "*.{js,scss}": [
        "prettier-eslint --write",
        "git add"
      ]
    },
    "ignore": [
      "**/src/scripts/*.min.js"
    ]
  },

Documentation need to be updated.

Steps to reproduce

Install version 7.20 Add the following config in package.json:

  "lint-staged": {
      "*.{js,scss}": [
        "prettier-eslint --write",
        "git add"
      ]
    "ignore": [
      "**/src/scripts/*.min.js"
    ]
  },

Environment

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

18reactions
sudo-suhascommented, Jul 6, 2018

Nice rant. Like I said. A PR is welcome.

11reactions
albanxcommented, Jul 6, 2018

We are to the classic problem here, who writes the code thinks usage/documentation is clear and obvious. Neither the advance config format neither the warning does not explain, or give an example how a correct config should be. Literally here is the avance format:

Advanced config format To set options and keep lint-staged extensible, advanced format can be used. This should hold linters object in linters property.

To set options and keep lint-staged extensible, advanced format can be used This does not say nothing, what options?, what does it mean keep extensible? What about: To customize lint-staged some advance options are available:

This should hold linters object in linters property. What is the linters object? What is the linters property? and where should I keep it? What about: To use the avance options the config format should be as the following:

   "lint-staged": {
    "linters": {
      "*.{js,scss}": [
        "prettier-eslint --write",
        "git add"
      ]
    },
    "ignore": [
      "**/src/scripts/*.min.js"
    ]
  }

Now is useless to discuss on this and point references how documentation should be written. Just keep in mind that when we write configuration documentation we should put ourself in other shoes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
Configuring Jest
The file will be discovered automatically, if it is named jest.config.js|ts|mjs|cjs|json . You can use --config flag to pass an explicit path to ......
Read more >
Could not find a declaration file for module 'vue-xxx'
I have tried 'vue-treeselect', 'vue-select', 'vue-multiselect' with more or less the same result (* those libraries don't allow import ...
Read more >
Troubleshooting Common Errors - Gatsby
Problems installing sharp with gatsby-plugin-sharp - gyp ERR! build error ... The version of Node.js that's used to install sharp needs to match...
Read more >
Converse.js API Documentation Source: headless/dist ...
"While position does not point past the end of data:" for (let i = 0; i < data.length; i++) { // "Find the...
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