Skip to content

Commit

Permalink
feat: add eslint & eslint-plugin-compat (#54)
Browse files Browse the repository at this point in the history
## Description of the change
This PR adds eslint configuration for fixing browser compatibility
errors.

However this doesn't detect array methods such as `toSorted` #53
amilajack/eslint-plugin-compat#258 (comment).
I've also tried to add
https://github.com/azu/eslint-plugin-typescript-compat for detecting the
methods. But no luck. 😩

- Add eslint config for the project
- Add `eslint-plugin-compat` for browser compatibilities
- Add to `package.json`
```
 "browserslist": [
    "chrome 64",
    "edge 79",
    "firefox 67",
    "opera 51",
    "safari 12"
  ]
```
I've disabled the recommended rules as there quite a lot of error and we
can tackle them in another PR.
<img width="461" alt="Screenshot 2024-02-28 at 17 09 56"
src="https://github.com/saasquatch/bunshi/assets/17547035/9be59f4c-f58b-4552-a868-532f579d3466">

---------

Co-authored-by: Logan Volkers <[email protected]>
  • Loading branch information
andrewdoro and loganvolkers authored May 15, 2024
1 parent 22e1d80 commit 4bd5fce
Show file tree
Hide file tree
Showing 3 changed files with 1,228 additions and 10 deletions.
21 changes: 21 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"env": {
"browser": true
},
"extends": [
"plugin:compat/recommended"
// "eslint:recommended",
// "plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["compat", "@typescript-eslint"],
"rules": {
"compat/compat": "error"
},
"ignorePatterns": ["examples/**", "dist/**", "node_modules/**", "website/**"],
"settings": { "lintAllEsApis": true }
}
Loading

0 comments on commit 4bd5fce

Please sign in to comment.