4 ms·
I currently use a highly opinionated ESLint config (based on the airbnb one) together with strict checking in my TypeScript config, and it is configured to run
by hn_throwaway_99 6y ago
I currently use a highly opinionated ESLint config (based on the airbnb one) together with strict checking in my TypeScript config, and it is configured to run on every commit with husky git hooks. The example given on the Semgrep homepage is an exact match to one that exists in my ESLint config (eslint's no-console rule).
How does Semgrep compare to ESLint+a strict tsconfig?
- avodonosov 6y agoHow do you deal with false positives? If the commit hook rejects anything where rules are triggered, a way to force the comrit is needed for the cases when the rule finding is not reanny an issue. Upd: I found that the --no-verify option can be used in many cases
- hn_throwaway_99 6y agoYou can put comments in the code to ignore eslint rules on a specific line, or for the whole file.
- RichieAHB 6y agoIt seems from reading the docs that the “semantic” side is important here. It can track things like redefinitions. E.g. const output = console.log; output(“hello”); This wouldn’t be caught by ESLint (to my knowledge) but would be caught by Semgrep. I think you could do it with ESLint but given the interface for an ESLint plugin exposes an AST, you’d have to track this yourself. I’m assuming Semgrep could stretch to things like enforcing APIs are called with certain optional arguments present (even if the TS types don’t require it). Again, I think with ESLint you’d have to do more juggling with the raw AST. That said, this is my understanding from a quick skim!