Add a basic eslint linter config, and fixes some bugs that it caught#12
Merged
tbo47 merged 4 commits intotbo47:mainfrom Dec 14, 2022
Merged
Add a basic eslint linter config, and fixes some bugs that it caught#12tbo47 merged 4 commits intotbo47:mainfrom
eslint linter config, and fixes some bugs that it caught#12tbo47 merged 4 commits intotbo47:mainfrom
Conversation
This eslint configuration was created with `npm init @eslint/config`. I've set it up to only use ES6 compatible JavaScript, we can increase this later if you want to support new JavaScript features.
This function was actually overwriting itself, not createEdgeLabels. This was caught by eslint! Fixes: 60d4b25
The [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import) checks for basic ESM import issues.
In ESM, file extensions are mandatory. Some bundlers/typescript allow not having file extensions, but Node.JS requires them (and `index.js`) for files see https://nodejs.org/api/esm.html#mandatory-file-extensions I've also fixed a bug in `src/dagre/debug.js`, which was importing a library that didn't exist (wrong folder).
3 tasks
tbo47
reviewed
Dec 14, 2022
| module.exports = { | ||
| env: { | ||
| browser: true, | ||
| es6: true, // todo, increase this es2016 or later to use new Javascript features |
Owner
There was a problem hiding this comment.
I suggest we use es2021. What do you use in marmaid-js?
Closed
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a pretty big PR that changes a bunch of things, but I tried to keep each commit separate to make things easier to review (you can view changes by commit in the GitHub review page).
If you want, I'd be happy to break this up into smaller PRs.
This PR uses
eslintandeslint-plugin-importto automatically check for issues in the code.In doing so, I caught three different types of bugs:
setCreateEdgeLabelswas overwriting itselfsrc/dagre/debug.jswas importing a file that didn't exist (wrong folder).jsor/index.js.Some bundlers/typescript allow not having file extensions, but Node.JS requires them (and
index.js) for files see https://nodejs.org/api/esm.html#mandatory-file-extensions