Skip to content

Commit a371481

Browse files
authored
Use our own babel-eslint fork, with the reference to patch-eslint-scope removed, and: (codesandbox#2001)
- remove unneeded code from webpack config - fix PR build URL to use https - fix the a11y linting bug - extract jest messages to common
1 parent 6a76495 commit a371481

File tree

9 files changed

+55
-81
lines changed

9 files changed

+55
-81
lines changed

.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
"no-param-reassign": ["error", { "props": false }],
4444
"camelcase": "error",
4545
"react-hooks/rules-of-hooks": "error",
46-
"react-hooks/exhaustive-deps": "warn"
46+
"react-hooks/exhaustive-deps": "warn",
47+
"jsx-a11y/href-no-hash": "off",
48+
"jsx-a11y/anchor-is-valid": ["warn", { "aspects": ["noHref", "invalidHref"] }],
49+
"jsx-a11y/label-has-for": "off"
4750
},
4851
"overrides": [
4952
{

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@
5454
"devDependencies": {
5555
"@types/react": "^16.8.12",
5656
"all-contributors-cli": "^5.4.0",
57-
"babel-eslint": "^10.0.1",
57+
"babel-eslint": "codesandbox/babel-eslint#v10.0.2",
5858
"eslint": "5.16.0",
5959
"eslint-config-airbnb": "^15.0.1",
6060
"eslint-config-prettier": "^4.2.0",
6161
"eslint-import-resolver-webpack": "^0.8.1",
6262
"eslint-loader": "^1.7.1",
6363
"eslint-plugin-flowtype": "^2.34.0",
6464
"eslint-plugin-import": "^2.3.0",
65-
"eslint-plugin-jsx-a11y": "^5.0.3",
65+
"eslint-plugin-jsx-a11y": "^6.1.0",
6666
"eslint-plugin-react": "~7.4.0",
6767
"eslint-plugin-react-hooks": "^1.6.0",
6868
"flow-bin": "^0.72.0",

packages/app/config/webpack.common.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,6 @@ module.exports = {
224224
flags: 'g',
225225
},
226226
},
227-
{
228-
test: new RegExp(
229-
`babel-eslint${sepRe}lib${sepRe}patch-eslint-scope\\.js$`
230-
),
231-
loader: 'string-replace-loader',
232-
options: {
233-
search: '[\\s\\S]+', // whole file.
234-
replace: 'module.exports = () => {}',
235-
flags: 'g',
236-
},
237-
},
238227
// Remove dynamic require in jest circus
239228
{
240229
test: /format_node_assert_errors\.js/,

packages/app/src/app/components/CodeEditor/Monaco/workers/linter/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const allRules = {
3030
'jsx-a11y/aria-role': require('eslint-plugin-jsx-a11y/lib/rules/aria-role'),
3131
'jsx-a11y/aria-unsupported-elements': require('eslint-plugin-jsx-a11y/lib/rules/aria-unsupported-elements'),
3232
'jsx-a11y/heading-has-content': require('eslint-plugin-jsx-a11y/lib/rules/heading-has-content'),
33-
'jsx-a11y/href-no-hash': require('eslint-plugin-jsx-a11y/lib/rules/href-no-hash'),
33+
'jsx-a11y/anchor-is-valid': require('eslint-plugin-jsx-a11y/lib/rules/anchor-is-valid'),
3434
'jsx-a11y/iframe-has-title': require('eslint-plugin-jsx-a11y/lib/rules/iframe-has-title'),
3535
'jsx-a11y/img-redundant-alt': require('eslint-plugin-jsx-a11y/lib/rules/img-redundant-alt'),
3636
'jsx-a11y/no-access-key': require('eslint-plugin-jsx-a11y/lib/rules/no-access-key'),
@@ -286,13 +286,18 @@ const DEFAULT_RULES = {
286286
'jsx-a11y/accessible-emoji': 'warn',
287287
'jsx-a11y/alt-text': 'warn',
288288
'jsx-a11y/anchor-has-content': 'warn',
289+
'jsx-a11y/anchor-is-valid': [
290+
'warn',
291+
{
292+
aspects: ['noHref', 'invalidHref'],
293+
},
294+
],
289295
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
290296
'jsx-a11y/aria-props': 'warn',
291297
'jsx-a11y/aria-proptypes': 'warn',
292298
'jsx-a11y/aria-role': 'warn',
293299
'jsx-a11y/aria-unsupported-elements': 'warn',
294300
'jsx-a11y/heading-has-content': 'warn',
295-
'jsx-a11y/href-no-hash': 'warn',
296301
'jsx-a11y/iframe-has-title': 'warn',
297302
'jsx-a11y/img-redundant-alt': 'warn',
298303
'jsx-a11y/no-access-key': 'warn',

packages/app/src/app/components/Preview/DevTools/Tests/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import TestDetailsContent from './TestDetails';
1212
import TestSummary from './TestSummary';
1313
import TestOverview from './TestOverview';
1414
import { DevToolProps } from '..';
15-
import { messages } from './../../../../../../src/sandbox/eval/tests/jest-lite';
15+
import { messages } from '@codesandbox/common/lib/utils/jest-lite';
1616

1717
export type IMessage = {
1818
type: 'message' | 'command' | 'return';

packages/app/src/sandbox/eval/tests/jest-lite.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { dispatch, actions, listen } from 'codesandbox-api';
22
import { react, reactTs } from '@codesandbox/common/lib/templates';
3+
import { messages } from '@codesandbox/common/lib/utils/jest-lite';
4+
export { messages };
5+
36
import expect from 'jest-matchers';
47
import jestMock from 'jest-mock';
58
import jestTestHooks from 'jest-circus';
@@ -87,20 +90,6 @@ function resetTestState() {
8790
setState(INITIAL_STATE);
8891
}
8992

90-
export enum messages {
91-
INITIALIZE = 'initialize_tests',
92-
ADD_FILE = 'add_file',
93-
REMOVE_FILE = 'remove_file',
94-
FILE_ERROR = 'file_error',
95-
TOTAL_TEST_START = 'total_test_start',
96-
TOTAL_TEST_END = 'total_test_end',
97-
TEST_START = 'test_start',
98-
TEST_END = 'test_end',
99-
DESCRIBE_START = 'describe_start',
100-
DESCRIBE_END = 'describe_end',
101-
ADD_TEST = 'add_test',
102-
}
103-
10493
export default class TestRunner {
10594
tests: Array<Module>;
10695
ranTests: Set<string>;

packages/common/src/utils/host.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default () => {
1010
}
1111

1212
if ('STAGING_BRANCH' in process.env) {
13-
return `http://${process.env.STAGING_BRANCH}.build.csb.dev`;
13+
return `https://${process.env.STAGING_BRANCH}.build.csb.dev`;
1414
}
1515

1616
if ('ROOT_URL' in process.env) {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export enum messages {
2+
INITIALIZE = 'initialize_tests',
3+
ADD_FILE = 'add_file',
4+
REMOVE_FILE = 'remove_file',
5+
FILE_ERROR = 'file_error',
6+
TOTAL_TEST_START = 'total_test_start',
7+
TOTAL_TEST_END = 'total_test_end',
8+
TEST_START = 'test_start',
9+
TEST_END = 'test_end',
10+
DESCRIBE_START = 'describe_start',
11+
DESCRIBE_END = 'describe_end',
12+
ADD_TEST = 'add_test',
13+
}

yarn.lock

Lines changed: 24 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3848,14 +3848,6 @@ argv-formatter@~1.0.0:
38483848
version "1.0.0"
38493849
resolved "https://registry.yarnpkg.com/argv-formatter/-/argv-formatter-1.0.0.tgz#a0ca0cbc29a5b73e836eebe1cbf6c5e0e4eb82f9"
38503850

3851-
aria-query@^0.7.0:
3852-
version "0.7.1"
3853-
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-0.7.1.tgz#26cbb5aff64144b0a825be1846e0b16cfa00b11e"
3854-
integrity sha1-Jsu1r/ZBRLCoJb4YRuCxbPoAsR4=
3855-
dependencies:
3856-
ast-types-flow "0.0.7"
3857-
commander "^2.11.0"
3858-
38593851
aria-query@^3.0.0:
38603852
version "3.0.0"
38613853
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc"
@@ -4240,14 +4232,7 @@ axios@^0.18.0:
42404232
follow-redirects "^1.3.0"
42414233
is-buffer "^1.1.5"
42424234

4243-
axobject-query@^0.1.0:
4244-
version "0.1.0"
4245-
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-0.1.0.tgz#62f59dbc59c9f9242759ca349960e7a2fe3c36c0"
4246-
integrity sha1-YvWdvFnJ+SQnWco0mWDnov48NsA=
4247-
dependencies:
4248-
ast-types-flow "0.0.7"
4249-
4250-
axobject-query@^2.0.1:
4235+
axobject-query@^2.0.1, axobject-query@^2.0.2:
42514236
version "2.0.2"
42524237
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.2.tgz#ea187abe5b9002b377f925d8bf7d1c561adf38f9"
42534238
integrity sha512-MCeek8ZH7hKyO1rWUbKNQBbl4l2eY0ntk7OGi+q0RlafrCnfPxC06WZA+uebCfmYp4mNU9jRBP1AhGyf8+W3ww==
@@ -4298,10 +4283,10 @@ babel-core@^6.0.0, babel-core@^6.24.1, babel-core@^6.26.0, babel-core@^6.26.3:
42984283
slash "^1.0.0"
42994284
source-map "^0.5.7"
43004285

4301-
babel-eslint@^10.0.1:
4302-
version "10.0.1"
4303-
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.1.tgz#919681dc099614cd7d31d45c8908695092a1faed"
4304-
integrity sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ==
4286+
babel-eslint@^9.0.0:
4287+
version "9.0.0"
4288+
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-9.0.0.tgz#7d9445f81ed9f60aff38115f838970df9f2b6220"
4289+
integrity sha512-itv1MwE3TMbY0QtNfeL7wzak1mV47Uy+n6HtSOO4Xd7rvmO+tsGQSgyOEEgo6Y2vHZKZphaoelNeSVj4vkLA1g==
43054290
dependencies:
43064291
"@babel/code-frame" "^7.0.0"
43074292
"@babel/parser" "^7.0.0"
@@ -4310,10 +4295,9 @@ babel-eslint@^10.0.1:
43104295
eslint-scope "3.7.1"
43114296
eslint-visitor-keys "^1.0.0"
43124297

4313-
babel-eslint@^9.0.0:
4314-
version "9.0.0"
4315-
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-9.0.0.tgz#7d9445f81ed9f60aff38115f838970df9f2b6220"
4316-
integrity sha512-itv1MwE3TMbY0QtNfeL7wzak1mV47Uy+n6HtSOO4Xd7rvmO+tsGQSgyOEEgo6Y2vHZKZphaoelNeSVj4vkLA1g==
4298+
babel-eslint@codesandbox/babel-eslint#v10.0.2:
4299+
version "10.0.2"
4300+
resolved "https://codeload.github.com/codesandbox/babel-eslint/tar.gz/59308eb977bcd1a4cf1c98d29b019ca3a6546267"
43174301
dependencies:
43184302
"@babel/code-frame" "^7.0.0"
43194303
"@babel/parser" "^7.0.0"
@@ -8244,11 +8228,6 @@ d@1:
82448228
dependencies:
82458229
es5-ext "^0.10.9"
82468230

8247-
damerau-levenshtein@^1.0.0:
8248-
version "1.0.5"
8249-
resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.5.tgz#780cf7144eb2e8dbd1c3bb83ae31100ccc31a414"
8250-
integrity sha512-CBCRqFnpu715iPmw1KrdOrzRqbdFwQTwAWyyyYS42+iAgHCuXZ+/TdMgQkUENPomxEz9z1BEzuQU2Xw0kUuAgA==
8251-
82528231
damerau-levenshtein@^1.0.4:
82538232
version "1.0.4"
82548233
resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514"
@@ -9049,12 +9028,12 @@ [email protected]:
90499028
version "6.1.1"
90509029
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.1.1.tgz#c6cd0ec1b0642e2a3c67a1137efc5e796da4f88e"
90519030

9052-
emoji-regex@^6.1.0, emoji-regex@^6.5.1:
9031+
emoji-regex@^6.5.1:
90539032
version "6.5.1"
90549033
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.5.1.tgz#9baea929b155565c11ea41c6626eaa65cef992c2"
90559034
integrity sha512-PAHp6TxrCy7MGMFidro8uikr+zlJJKJ/Q6mm2ExZ7HwkyR9lSVFfE3kt36qcwa24BQL7y0G9axycGjK1A/0uNQ==
90569035

9057-
emoji-regex@^7.0.1:
9036+
emoji-regex@^7.0.1, emoji-regex@^7.0.2:
90589037
version "7.0.3"
90599038
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156"
90609039
integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==
@@ -9524,19 +9503,6 @@ eslint-plugin-import@^2.9.0:
95249503
read-pkg-up "^2.0.0"
95259504
resolve "^1.6.0"
95269505

9527-
eslint-plugin-jsx-a11y@^5.0.3:
9528-
version "5.1.1"
9529-
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-5.1.1.tgz#5c96bb5186ca14e94db1095ff59b3e2bd94069b1"
9530-
integrity sha512-5I9SpoP7gT4wBFOtXT8/tXNPYohHBVfyVfO17vkbC7r9kEIxYJF12D3pKqhk8+xnk12rfxKClS3WCFpVckFTPQ==
9531-
dependencies:
9532-
aria-query "^0.7.0"
9533-
array-includes "^3.0.3"
9534-
ast-types-flow "0.0.7"
9535-
axobject-query "^0.1.0"
9536-
damerau-levenshtein "^1.0.0"
9537-
emoji-regex "^6.1.0"
9538-
jsx-ast-utils "^1.4.0"
9539-
95409506
eslint-plugin-jsx-a11y@^6.0.3:
95419507
version "6.1.2"
95429508
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.1.2.tgz#69bca4890b36dcf0fe16dd2129d2d88b98f33f88"
@@ -9550,6 +9516,20 @@ eslint-plugin-jsx-a11y@^6.0.3:
95509516
has "^1.0.3"
95519517
jsx-ast-utils "^2.0.1"
95529518

9519+
eslint-plugin-jsx-a11y@^6.1.0:
9520+
version "6.2.1"
9521+
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.2.1.tgz#4ebba9f339b600ff415ae4166e3e2e008831cf0c"
9522+
integrity sha512-cjN2ObWrRz0TTw7vEcGQrx+YltMvZoOEx4hWU8eEERDnBIU00OTq7Vr+jA7DFKxiwLNv4tTh5Pq2GUNEa8b6+w==
9523+
dependencies:
9524+
aria-query "^3.0.0"
9525+
array-includes "^3.0.3"
9526+
ast-types-flow "^0.0.7"
9527+
axobject-query "^2.0.2"
9528+
damerau-levenshtein "^1.0.4"
9529+
emoji-regex "^7.0.2"
9530+
has "^1.0.3"
9531+
jsx-ast-utils "^2.0.1"
9532+
95539533
[email protected], eslint-plugin-react-hooks@^1.6.0:
95549534
version "1.6.0"
95559535
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.6.0.tgz#348efcda8fb426399ac7b8609607c7b4025a6f5f"
@@ -15463,11 +15443,6 @@ jsprim@^1.2.2:
1546315443
json-schema "0.2.3"
1546415444
verror "1.10.0"
1546515445

15466-
jsx-ast-utils@^1.4.0:
15467-
version "1.4.1"
15468-
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1"
15469-
integrity sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=
15470-
1547115446
jsx-ast-utils@^2.0.0, jsx-ast-utils@^2.0.1:
1547215447
version "2.0.1"
1547315448
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz#e801b1b39985e20fffc87b40e3748080e2dcac7f"

0 commit comments

Comments
 (0)