Skip to content

Commit

Permalink
feat(eslint-config): lint browser compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
foray1010 committed Nov 17, 2020
1 parent 205803f commit 1059794
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 11 deletions.
1 change: 1 addition & 0 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@typescript-eslint/parser": "^4.0.1",
"confusing-browser-globals": "^1.0.9",
"eslint-config-prettier": "^6.3.0",
"eslint-plugin-compat": "^3.8.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jest": "^24.0.0",
"eslint-plugin-jest-dom": "^3.0.1",
Expand Down
14 changes: 14 additions & 0 deletions packages/eslint-config/presets/browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict'

const restrictedGlobals = require('confusing-browser-globals')

module.exports = {
extends: ['plugin:compat/recommended'],
plugins: ['eslint-plugin-compat'],
env: {
browser: true,
},
rules: {
'no-restricted-globals': ['error', ...restrictedGlobals],
},
}
12 changes: 5 additions & 7 deletions packages/eslint-config/presets/react.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict'

const restrictedGlobals = require('confusing-browser-globals')

const { testFileGlobs } = require('./utils/testUtil')

module.exports = {
Expand All @@ -12,17 +10,17 @@ module.exports = {
jsx: true,
},
},
plugins: ['eslint-plugin-react', 'eslint-plugin-react-hooks'],
env: {
browser: true,
},
plugins: [
'eslint-config-prettier',
'eslint-plugin-react',
'eslint-plugin-react-hooks',
],
settings: {
react: {
version: 'detect',
},
},
rules: {
'no-restricted-globals': ['error', ...restrictedGlobals],
'react/jsx-no-useless-fragment': 'error',
'react/jsx-sort-props': [
'error',
Expand Down
7 changes: 6 additions & 1 deletion packages/eslint-config/react.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
'use strict'

module.exports = {
extends: ['./presets/base.js', './presets/node.js', './presets/react.js'],
extends: [
'./presets/base.js',
'./presets/node.js',
'./presets/browser.js',
'./presets/react.js',
],
}
42 changes: 39 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2474,6 +2474,11 @@ assign-symbols@^1.0.0:
resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367"
integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=

ast-metadata-inferer@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/ast-metadata-inferer/-/ast-metadata-inferer-0.4.0.tgz#6be85ceeffcf267bd79db8e1ae731da44880b45f"
integrity sha512-tKHdBe8N/Vq2nLAm4YPBVREVZjMux6KrqyPfNQgIbDl0t7HaNSmy8w4OyVHYg/cvyn5BW7o7pVwpjPte89Zhcg==

astral-regex@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
Expand Down Expand Up @@ -2602,7 +2607,7 @@ braces@^3.0.1, braces@~3.0.2:
dependencies:
fill-range "^7.0.1"

browserslist@^4.12.0, browserslist@^4.14.5, browserslist@^4.14.6, browserslist@^4.14.7:
browserslist@^4.12.0, browserslist@^4.12.2, browserslist@^4.14.5, browserslist@^4.14.6, browserslist@^4.14.7:
version "4.14.7"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.14.7.tgz#c071c1b3622c1c2e790799a37bb09473a4351cb6"
integrity sha512-BSVRLCeG3Xt/j/1cCGj1019Wbty0H+Yvu2AOuZSuoaUWn3RatbL33Cxk+Q4jRMRAbOm0p7SLravLjpnT6s0vzQ==
Expand Down Expand Up @@ -2765,6 +2770,11 @@ camelcase@^5.0.0, camelcase@^5.3.1:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==

caniuse-db@^1.0.30001090:
version "1.0.30001158"
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30001158.tgz#6d504a214cdb4acb0281004669f01cba45fdc07a"
integrity sha512-NknNNrTTwyf7woTu/Nsdv3iKAZNlVQgeXtV5DysNGbHsS10VXo0cYOmxcMad+VHyO2TKiaWBh9Si7mmkcZ26tw==

caniuse-lite@^1.0.30001157:
version "1.0.30001158"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001158.tgz#fce86d321369603c2bc855ee0e901a7f49f8310b"
Expand Down Expand Up @@ -3239,7 +3249,7 @@ core-js-compat@^3.6.2:
browserslist "^4.14.6"
semver "7.0.0"

core-js@^3.6.1:
core-js@^3.6.1, core-js@^3.6.5:
version "3.7.0"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.7.0.tgz#b0a761a02488577afbf97179e4681bf49568520f"
integrity sha512-NwS7fI5M5B85EwpWuIwJN4i/fbisQUwLwiSNUWeXlkAZ0sbBjLEvLvFLf1uzAUV66PcEPt4xCGCmOZSxVf3xzA==
Expand Down Expand Up @@ -3764,6 +3774,20 @@ eslint-module-utils@^2.6.0:
debug "^2.6.9"
pkg-dir "^2.0.0"

eslint-plugin-compat@^3.8.0:
version "3.8.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-compat/-/eslint-plugin-compat-3.8.0.tgz#2348d6105e7e87b823ae3b97b349512a2a45a7f2"
integrity sha512-5CuWUSZXZkXLCQJBriEpndn/YWrvggDSHTpRJq++kR8GVcsWbTdp8Eh+nBA7JlrNi7ZJ/+kniOVXmn3bpnxuRA==
dependencies:
ast-metadata-inferer "^0.4.0"
browserslist "^4.12.2"
caniuse-db "^1.0.30001090"
core-js "^3.6.5"
find-up "^4.1.0"
lodash.memoize "4.1.2"
mdn-browser-compat-data "^1.0.28"
semver "7.3.2"

eslint-plugin-es@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz#75a7cdfdccddc0589934aeeb384175f221c57893"
Expand Down Expand Up @@ -4031,7 +4055,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2:
assign-symbols "^1.0.0"
is-extendable "^1.0.1"

extend@^3.0.0, extend@~3.0.2:
extend@3.0.2, extend@^3.0.0, extend@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==
Expand Down Expand Up @@ -5674,6 +5698,11 @@ lodash.ismatch@^4.4.0:
resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37"
integrity sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc=

lodash.memoize@4.1.2:
version "4.1.2"
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=

lodash.set@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23"
Expand Down Expand Up @@ -5897,6 +5926,13 @@ mdast-util-to-string@^1.0.0, mdast-util-to-string@^1.0.2:
resolved "https://registry.yarnpkg.com/mdast-util-to-string/-/mdast-util-to-string-1.1.0.tgz#27055500103f51637bd07d01da01eb1967a43527"
integrity sha512-jVU0Nr2B9X3MU4tSK7JP1CMkSvOj7X5l/GboG1tKRw52lLF1x2Ju92Ms9tNetCcbfX3hzlM73zYo2NKkWSfF/A==

mdn-browser-compat-data@^1.0.28:
version "1.1.2"
resolved "https://registry.yarnpkg.com/mdn-browser-compat-data/-/mdn-browser-compat-data-1.1.2.tgz#90d2a25ce731b34a14329396887dadfd657ea7b2"
integrity sha512-uBNX2P4iu3PZcXP20rL+n7fxN9PWZLj0y43QMe/1aXzqP3H6HbVOeePS0cBZCtMwcfr2Tugf1OHj+/wLam+dUg==
dependencies:
extend "3.0.2"

mem@^4.0.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/mem/-/mem-4.3.0.tgz#461af497bc4ae09608cdb2e60eefb69bff744178"
Expand Down

0 comments on commit 1059794

Please sign in to comment.