Introduction of eslint in the project #2318
Unanswered
waldekmastykarz
asked this question in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We've just introduced eslint to CLI for Microsoft 365. Using eslint we want to standardize how we write code and simplify code reviews, which should speed up PRs and shipping your work.
To start, we've enabled some common rules. Most noteworthy that were flagged on our code base, and which have been fixed, are:
Linting code is a part of running the test suite. When you run
npm test
, the script will first run the linter and run tests only if linter passed. You can also run linter standalone throughnpm run lint
.If you've been working on a bigger change or linter flagged many issues, you can try to automatically fix some of them by running
npm run lint -- --fix
. Keep in mind that not all eslint rules support autofixing and you might need to fix some of them manually.If you use VSCode as your editor, you can use the eslint extension that will check your code and report issues, if any, in the problems pane, from where you can also fix them if the rule supports it.
On a rare occasion, you might need to suppress a specific rule occurrence. Please use it as a last resort and only if necessary. When you do, please include a comment justifying your decision. It will help us maintain the code in the future.
Linting is run as a part of PR and release testing, so if you didn't run tests before submitting a PR, there is a chance that the PR build will fail on lint.
If you see any oddities or have suggestions how we could improve using eslint, don't hesitate to reach out.
Beta Was this translation helpful? Give feedback.
All reactions