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

Possible false positive in the config validation #263

Closed
okonet opened this issue Sep 5, 2017 · 1 comment · Fixed by opencomponents/base-templates#128
Closed

Possible false positive in the config validation #263

okonet opened this issue Sep 5, 2017 · 1 comment · Fixed by opencomponents/base-templates#128

Comments

@okonet
Copy link
Collaborator

okonet commented Sep 5, 2017

Following config

  "lint-staged": {
    "linters": {
      "*.js": [
        "npm run lint:js -- --fix",
        "git add"
      ],
      "*.json": [
        "npm run lint:js -- --fix",
        "git add"
      ],
      "*.md": [
        "npm run lint:md -- -o",
        "git add"
      ]
    },
    "verbose": true,
    "concurrent": false
  },

causes the following error when running lint-staged:

Running lint-staged with the following config:
{
	linters: {
		'*.js': [
			'npm run lint:js -- --fix',
			'git add'
		],
		'*.json': [
			'npm run lint:js -- --fix',
			'git add'
		],
		'*.md': [
			'npm run lint:md -- -o',
			'git add'
		]
	},
	verbose: true,
	concurrent: false,
	chunkSize: 9007199254740991,
	gitDir: '.',
	globOptions: {
		matchBase: true,
		dot: true
	},
	subTaskConcurrency: 1,
	renderer: 'verbose'
}

Could not parse lint-staged config.
Make sure you have created it. See https://github.com/okonet/lint-staged#readme.

Error: Invalid config provided to runAll! Use getConfig instead.


husky > pre-commit hook failed (add --no-verify to bypass)

Then config is changed to following error disappears:

  "lint-staged": {
    "linters": {
      "*.js": [
        "npm run lint:js -- --fix",
        "git add"
      ],
      "*.json": [
        "npm run lint:js -- --fix",
        "git add"
      ],
      "*.md": [
        "npm run lint:md -- -o",
        "git add"
      ]
    },
    "verbose": true
  },
@okonet
Copy link
Collaborator Author

okonet commented Sep 5, 2017

I've identified the problem and it's the sketchy comparison for null/undefined here:

https://github.com/okonet/lint-staged/blob/d99eb3815cbcb7f76d0adf693fe4017c8e31cf7c/src/runAll.js#L17

I'll create a fix soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment