{"action":"created","issue":{"url":"https://api.github.com/repos/okonet/lint-staged/issues/419","repository_url":"https://api.github.com/repos/okonet/lint-staged","labels_url":"https://api.github.com/repos/okonet/lint-staged/issues/419/labels{/name}","comments_url":"https://api.github.com/repos/okonet/lint-staged/issues/419/comments","events_url":"https://api.github.com/repos/okonet/lint-staged/issues/419/events","html_url":"https://github.com/okonet/lint-staged/issues/419","id":310160969,"number":419,"title":"eslint with --rule option not working properly","user":{"login":"tgreen7","id":10415101,"avatar_url":"https://avatars2.githubusercontent.com/u/10415101?v=4","gravatar_id":"","url":"https://api.github.com/users/tgreen7","html_url":"https://github.com/tgreen7","followers_url":"https://api.github.com/users/tgreen7/followers","following_url":"https://api.github.com/users/tgreen7/following{/other_user}","gists_url":"https://api.github.com/users/tgreen7/gists{/gist_id}","starred_url":"https://api.github.com/users/tgreen7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgreen7/subscriptions","organizations_url":"https://api.github.com/users/tgreen7/orgs","repos_url":"https://api.github.com/users/tgreen7/repos","events_url":"https://api.github.com/users/tgreen7/events{/privacy}","received_events_url":"https://api.github.com/users/tgreen7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-03-30T20:27:26Z","updated_at":"2018-03-31T15:55:49Z","closed_at":null,"author_association":"NONE","body":"### Steps to reproduce\r\n\r\nHere is a example repo: https://github.com/tgreen7/lint-staged-eslint-rule\r\n\r\nif you modify index.js, git add index.js, and run yarn precommit then no errors will be logged. However, if you uncomment the line `quotes: [2, 'double']` in the .eslintrc.js file and re-run the precommit then the error will be logged. \r\n\r\nAlso you can try to run yarn lint, which adds that rule in the same way as the precommit, and it does get linted properly.\r\n\r\nIf I am passing that same rule to the precommit through the eslint --rule option then why is it not getting picked up while running?\r\n\r\n### Debug Logs\r\n\r\n<!--\r\nRun `lint-staged` in debug mode using the command line flag `--debug`. You can\r\neither modify your pre-commit script/command to include the flag or invoke\r\n`lint-staged` manually(`./node_modules/.bin/lint-staged --debug`). Read more\r\nabout debug mode here -\r\nhttps://github.com/okonet/lint-staged#command-line-flags.\r\n\r\nNOTE: This requires `lint-staged` version >= `6.0.0`.\r\n-->\r\n<details>\r\n\r\n<summary>expand to view</summary>\r\n\r\n```\r\n[taoh:.../lint-staged-test] ❯ ./node_modules/.bin/lint-staged --debug                                                   ✚ :: master  :: ⬡\r\n  lint-staged:bin Running `lint-staged@7.0.0` +0ms\r\n  lint-staged Loading config using `cosmiconfig` +0ms\r\n  lint-staged Successfully loaded config from `/Users/taoh/Sites/lint-staged-test/package.json`:\r\n  lint-staged { 'index.js': [ 'eslint --rule \\'quotes: [2, double]\\'' ] } +3ms\r\n  lint-staged:cfg Normalizing config +0ms\r\n  lint-staged:cfg Validating config +2ms\r\nRunning lint-staged with the following config:\r\n{\r\n  linters: {\r\n    'index.js': [\r\n      'eslint --rule \\'quotes: [2, double]\\''\r\n    ]\r\n  },\r\n  concurrent: true,\r\n  chunkSize: 9007199254740991,\r\n  globOptions: {\r\n    matchBase: true,\r\n    dot: true\r\n  },\r\n  ignore: [],\r\n  subTaskConcurrency: 1,\r\n  renderer: 'verbose'\r\n}\r\n  lint-staged:run Running all linter scripts +0ms\r\n  lint-staged:run Resolved git directory to be `/Users/taoh/Sites/lint-staged-test` +1ms\r\n  lint-staged:run Loaded list of staged files in git:\r\n  lint-staged:run [ 'index.js' ] +28ms\r\n  lint-staged:gen-tasks Generating linter tasks +0ms\r\n  lint-staged:cfg Normalizing config +35ms\r\n  lint-staged:gen-tasks Generated task:\r\n  lint-staged:gen-tasks { pattern: 'index.js',\r\n  lint-staged:gen-tasks   commands: [ 'eslint --rule \\'quotes: [2, double]\\'' ],\r\n  lint-staged:gen-tasks   fileList: [ '/Users/taoh/Sites/lint-staged-test/index.js' ] } +2ms\r\nRunning tasks for index.js [started]\r\n  lint-staged:run-script Running script with commands [ 'eslint --rule \\'quotes: [2, double]\\'' ] +0ms\r\n  lint-staged:cfg Normalizing config +5ms\r\neslint --rule 'quotes: [2, double]' [started]\r\n  lint-staged:find-bin Resolving binary for command `eslint --rule 'quotes: [2, double]'` +0ms\r\n  lint-staged:find-bin Binary for `eslint --rule 'quotes: [2, double]'` resolved to `/Users/taoh/Sites/lint-staged-test/node_modules/.bin/eslint` +3ms\r\n  lint-staged:run-script bin: /Users/taoh/Sites/lint-staged-test/node_modules/.bin/eslint +5ms\r\n  lint-staged:run-script args: [ '--rule',\r\n  lint-staged:run-script   '\\'quotes:',\r\n  lint-staged:run-script   '[2,',\r\n  lint-staged:run-script   'double]\\'',\r\n  lint-staged:run-script   '/Users/taoh/Sites/lint-staged-test/index.js' ] +0ms\r\n  lint-staged:run-script opts: { reject: false } +1ms\r\neslint --rule 'quotes: [2, double]' [completed]\r\nRunning tasks for index.js [completed]\r\n  lint-staged linters were executed successfully! +549ms\r\n```\r\n\r\n</details>\r\n\r\n### Environment\r\n\r\n<!-- Tell us about your development environment -->\r\n- **OS:** macOS High Sierra \r\n- **Node.js:** v9.8.0\r\n- **`lint-staged`:** v7.0.0\r\n"},"comment":{"url":"https://api.github.com/repos/okonet/lint-staged/issues/comments/377702806","html_url":"https://github.com/okonet/lint-staged/issues/419#issuecomment-377702806","issue_url":"https://api.github.com/repos/okonet/lint-staged/issues/419","id":377702806,"user":{"login":"okonet","id":11071,"avatar_url":"https://avatars3.githubusercontent.com/u/11071?v=4","gravatar_id":"","url":"https://api.github.com/users/okonet","html_url":"https://github.com/okonet","followers_url":"https://api.github.com/users/okonet/followers","following_url":"https://api.github.com/users/okonet/following{/other_user}","gists_url":"https://api.github.com/users/okonet/gists{/gist_id}","starred_url":"https://api.github.com/users/okonet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okonet/subscriptions","organizations_url":"https://api.github.com/users/okonet/orgs","repos_url":"https://api.github.com/users/okonet/repos","events_url":"https://api.github.com/users/okonet/events{/privacy}","received_events_url":"https://api.github.com/users/okonet/received_events","type":"User","site_admin":false},"created_at":"2018-03-31T15:55:49Z","updated_at":"2018-03-31T15:55:49Z","author_association":"OWNER","body":"@sudo-suhas not sure what you mean. It works for me on this repo:\r\n\r\n```\r\n➜ eslint --rule 'quotes: [2, double]' index.js \r\n\r\n/Users/okonet/Projects/OSS/lint-staged/index.js\r\n   3:1   error  Strings must use doublequote  quotes\r\n   5:25  error  Strings must use doublequote  quotes\r\n   6:26  error  Strings must use doublequote  quotes\r\n   7:21  error  Strings must use doublequote  quotes\r\n   9:24  error  Strings must use doublequote  quotes\r\n  13:11  error  Strings must use doublequote  quotes\r\n  13:34  error  Strings must use doublequote  quotes\r\n  14:11  error  Strings must use doublequote  quotes\r\n  14:26  error  Strings must use doublequote  quotes\r\n  18:19  error  Strings must use doublequote  quotes\r\n  21:7   error  Strings must use doublequote  quotes\r\n  23:9   error  Strings must use doublequote  quotes\r\n\r\n✖ 12 problems (12 errors, 0 warnings)\r\n  12 errors, 0 warnings potentially fixable with the `--fix` option.\r\n```"}}
{"actor":{"display_login":"okonet"}}