nickdeis / eslint-plugin-no-secrets

An eslint plugin to find strings that might be secrets/credentials
MIT License
127 stars 4 forks source link

Unexpected token v when used with eslint-plugin-json #11

Closed davidjbradshaw closed 3 years ago

davidjbradshaw commented 4 years ago

I get the following error when I have this package and eslint-plugin-json installed.

/dev/eslint-config-adjunct/package.json
  1:1  error  Unexpected token v

Downgrading to version 0.5.4 fixes the issue

nickdeis commented 4 years ago

Hey @davidjbradshaw, Thank you for taking the time to file this issue. I'll have to look into the eslint-plugin-json source, but it may be an issue that we both define parsers for JSON. I might be able to change my parser to be more compatible with it. I'll try to get to this sometime this week. Cheers, Nick

nickdeis commented 4 years ago

Hey @davidjbradshaw, Could you send me the eslint config that caused the issue? I'm finding an issue recreating your exact error (although I've found a different error). EDIT: Is it eslint-config-adjunct on master? Which version of eslint are you using? it seems like this issue may have been addressed here. Still, I'm facing a different issue than you where it doesn't even get input for the rules, so I might have to file an issue with eslint. Very good find! Cheers, Nick

davidjbradshaw commented 4 years ago

Yes it’s that project. Should be the latest version of esLint in there, unless it updated in the last few days

davidjbradshaw commented 4 years ago

I found the issue in this project, note that is currently setup to load v0.5.4 of your code. So you will need to push that too the latest version to repo this.

https://github.com/davidjbradshaw/eslint-config-adjunct

davidjbradshaw commented 4 years ago

Oh my bad, I should have said eslint-plugin-json-format, rather than eslint-plugin-json

davidjbradshaw commented 4 years ago

I found a workaround for me https://github.com/davidjbradshaw/eslint-config-adjunct/blob/master/rules/no-secrets.js

nickdeis commented 4 years ago

Hey @davidjbradshaw, Thank you for the additional input and I apologizing for the delay in fixing this. Life threw me a bit of a curveball this last month. I have filed an issue with the eslint team (as seen above), and I'm hoping they can help me out. I'm glad you found a workaround. Best, Nick

davidjbradshaw commented 4 years ago

Thanks for the update and no worries, I hope things are ok now. Just read your eslint ticket, that looks like a can of worms to solve.

nickdeis commented 3 years ago

Hey @davidjbradshaw, Thanks to @constgen and eslint-plugin-jsonc, we have finally found a workaround to this issue. Essentially, instead of parsing the JSON documents as JS, we extend the existing parser to add new tokens for JSON documents. This means no parsing collisions (unless someone extends the parser with the exact same token names). Thank You! Nick