Skip to content

Conversation

@danielstjules
Copy link
Contributor

@danielstjules danielstjules commented Jan 10, 2017

https://github.com/danielstjules/buddy.js is a tool that exists to identify magic numbers. Here's the result of running the example in the readme:

screen shot 2017-01-09 at 3 48 06 pm

Here's another example from the buddy.js readme:

intro-screenshot

I also mention eslint, which added a magic number rule based on buddy.js in https://github.com/eslint/eslint/blob/660e0918933e6e7fede26bc675a0763a6b357c94/lib/rules/no-magic-numbers.js#L2 Not sure if it handles the same test cases, but it's the only general linter I know of that detects these things.

@ryanmcdermott ryanmcdermott merged commit bfa3eb3 into ryanmcdermott:master Jan 10, 2017
@ryanmcdermott
Copy link
Owner

Woo hoo bring on the tools 🎉 You've got some great ones!

Tell Greg I say Hi by the way!

@danielstjules danielstjules deleted the magic-numbers branch January 10, 2017 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants