Skip to content

Commit

Permalink
Use our own babel-eslint fork, with the reference to patch-eslint-sco…
Browse files Browse the repository at this point in the history
…pe removed, and:

- remove unneeded code from webpack config
- fix PR build URL to use https
- fix the a11y linting bug
- extract jest messages to common
  • Loading branch information
lbogdan committed May 31, 2019
1 parent 6a76495 commit a432847
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 80 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
"devDependencies": {
"@types/react": "^16.8.12",
"all-contributors-cli": "^5.4.0",
"babel-eslint": "^10.0.1",
"babel-eslint": "codesandbox/babel-eslint#v10.0.2",
"eslint": "5.16.0",
"eslint-config-airbnb": "^15.0.1",
"eslint-config-prettier": "^4.2.0",
"eslint-import-resolver-webpack": "^0.8.1",
"eslint-loader": "^1.7.1",
"eslint-plugin-flowtype": "^2.34.0",
"eslint-plugin-import": "^2.3.0",
"eslint-plugin-jsx-a11y": "^5.0.3",
"eslint-plugin-jsx-a11y": "^6.1.0",
"eslint-plugin-react": "~7.4.0",
"eslint-plugin-react-hooks": "^1.6.0",
"flow-bin": "^0.72.0",
Expand Down
11 changes: 0 additions & 11 deletions packages/app/config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,6 @@ module.exports = {
flags: 'g',
},
},
{
test: new RegExp(
`babel-eslint${sepRe}lib${sepRe}patch-eslint-scope\\.js$`
),
loader: 'string-replace-loader',
options: {
search: '[\\s\\S]+', // whole file.
replace: 'module.exports = () => {}',
flags: 'g',
},
},
// Remove dynamic require in jest circus
{
test: /format_node_assert_errors\.js/,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const allRules = {
'jsx-a11y/aria-role': require('eslint-plugin-jsx-a11y/lib/rules/aria-role'),
'jsx-a11y/aria-unsupported-elements': require('eslint-plugin-jsx-a11y/lib/rules/aria-unsupported-elements'),
'jsx-a11y/heading-has-content': require('eslint-plugin-jsx-a11y/lib/rules/heading-has-content'),
'jsx-a11y/href-no-hash': require('eslint-plugin-jsx-a11y/lib/rules/href-no-hash'),
'jsx-a11y/anchor-is-valid': require('eslint-plugin-jsx-a11y/lib/rules/anchor-is-valid'),
'jsx-a11y/iframe-has-title': require('eslint-plugin-jsx-a11y/lib/rules/iframe-has-title'),
'jsx-a11y/img-redundant-alt': require('eslint-plugin-jsx-a11y/lib/rules/img-redundant-alt'),
'jsx-a11y/no-access-key': require('eslint-plugin-jsx-a11y/lib/rules/no-access-key'),
Expand Down Expand Up @@ -286,13 +286,18 @@ const DEFAULT_RULES = {
'jsx-a11y/accessible-emoji': 'warn',
'jsx-a11y/alt-text': 'warn',
'jsx-a11y/anchor-has-content': 'warn',
'jsx-a11y/anchor-is-valid': [
'warn',
{
aspects: ['noHref', 'invalidHref'],
},
],
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
'jsx-a11y/aria-props': 'warn',
'jsx-a11y/aria-proptypes': 'warn',
'jsx-a11y/aria-role': 'warn',
'jsx-a11y/aria-unsupported-elements': 'warn',
'jsx-a11y/heading-has-content': 'warn',
'jsx-a11y/href-no-hash': 'warn',
'jsx-a11y/iframe-has-title': 'warn',
'jsx-a11y/img-redundant-alt': 'warn',
'jsx-a11y/no-access-key': 'warn',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import TestDetailsContent from './TestDetails';
import TestSummary from './TestSummary';
import TestOverview from './TestOverview';
import { DevToolProps } from '..';
import { messages } from './../../../../../../src/sandbox/eval/tests/jest-lite';
import { messages } from '@codesandbox/common/lib/utils/jest-lite';

export type IMessage = {
type: 'message' | 'command' | 'return';
Expand Down
16 changes: 2 additions & 14 deletions packages/app/src/sandbox/eval/tests/jest-lite.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { dispatch, actions, listen } from 'codesandbox-api';
import { react, reactTs } from '@codesandbox/common/lib/templates';
import { messages } from '@codesandbox/common/lib/utils/jest-lite';

import expect from 'jest-matchers';
import jestMock from 'jest-mock';
import jestTestHooks from 'jest-circus';
Expand Down Expand Up @@ -87,20 +89,6 @@ function resetTestState() {
setState(INITIAL_STATE);
}

export enum messages {
INITIALIZE = 'initialize_tests',
ADD_FILE = 'add_file',
REMOVE_FILE = 'remove_file',
FILE_ERROR = 'file_error',
TOTAL_TEST_START = 'total_test_start',
TOTAL_TEST_END = 'total_test_end',
TEST_START = 'test_start',
TEST_END = 'test_end',
DESCRIBE_START = 'describe_start',
DESCRIBE_END = 'describe_end',
ADD_TEST = 'add_test',
}

export default class TestRunner {
tests: Array<Module>;
ranTests: Set<string>;
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/utils/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default () => {
}

if ('STAGING_BRANCH' in process.env) {
return `http://${process.env.STAGING_BRANCH}.build.csb.dev`;
return `https://${process.env.STAGING_BRANCH}.build.csb.dev`;
}

if ('ROOT_URL' in process.env) {
Expand Down
13 changes: 13 additions & 0 deletions packages/common/src/utils/jest-lite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export enum messages {
INITIALIZE = 'initialize_tests',
ADD_FILE = 'add_file',
REMOVE_FILE = 'remove_file',
FILE_ERROR = 'file_error',
TOTAL_TEST_START = 'total_test_start',
TOTAL_TEST_END = 'total_test_end',
TEST_START = 'test_start',
TEST_END = 'test_end',
DESCRIBE_START = 'describe_start',
DESCRIBE_END = 'describe_end',
ADD_TEST = 'add_test',
}
73 changes: 24 additions & 49 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3848,14 +3848,6 @@ argv-formatter@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/argv-formatter/-/argv-formatter-1.0.0.tgz#a0ca0cbc29a5b73e836eebe1cbf6c5e0e4eb82f9"

aria-query@^0.7.0:
version "0.7.1"
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-0.7.1.tgz#26cbb5aff64144b0a825be1846e0b16cfa00b11e"
integrity sha1-Jsu1r/ZBRLCoJb4YRuCxbPoAsR4=
dependencies:
ast-types-flow "0.0.7"
commander "^2.11.0"

aria-query@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-3.0.0.tgz#65b3fcc1ca1155a8c9ae64d6eee297f15d5133cc"
Expand Down Expand Up @@ -4240,14 +4232,7 @@ axios@^0.18.0:
follow-redirects "^1.3.0"
is-buffer "^1.1.5"

axobject-query@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-0.1.0.tgz#62f59dbc59c9f9242759ca349960e7a2fe3c36c0"
integrity sha1-YvWdvFnJ+SQnWco0mWDnov48NsA=
dependencies:
ast-types-flow "0.0.7"

axobject-query@^2.0.1:
axobject-query@^2.0.1, axobject-query@^2.0.2:
version "2.0.2"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.0.2.tgz#ea187abe5b9002b377f925d8bf7d1c561adf38f9"
integrity sha512-MCeek8ZH7hKyO1rWUbKNQBbl4l2eY0ntk7OGi+q0RlafrCnfPxC06WZA+uebCfmYp4mNU9jRBP1AhGyf8+W3ww==
Expand Down Expand Up @@ -4298,10 +4283,10 @@ babel-core@^6.0.0, babel-core@^6.24.1, babel-core@^6.26.0, babel-core@^6.26.3:
slash "^1.0.0"
source-map "^0.5.7"

babel-eslint@^10.0.1:
version "10.0.1"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.1.tgz#919681dc099614cd7d31d45c8908695092a1faed"
integrity sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ==
babel-eslint@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-9.0.0.tgz#7d9445f81ed9f60aff38115f838970df9f2b6220"
integrity sha512-itv1MwE3TMbY0QtNfeL7wzak1mV47Uy+n6HtSOO4Xd7rvmO+tsGQSgyOEEgo6Y2vHZKZphaoelNeSVj4vkLA1g==
dependencies:
"@babel/code-frame" "^7.0.0"
"@babel/parser" "^7.0.0"
Expand All @@ -4310,10 +4295,9 @@ babel-eslint@^10.0.1:
eslint-scope "3.7.1"
eslint-visitor-keys "^1.0.0"

babel-eslint@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-9.0.0.tgz#7d9445f81ed9f60aff38115f838970df9f2b6220"
integrity sha512-itv1MwE3TMbY0QtNfeL7wzak1mV47Uy+n6HtSOO4Xd7rvmO+tsGQSgyOEEgo6Y2vHZKZphaoelNeSVj4vkLA1g==
babel-eslint@codesandbox/babel-eslint#v10.0.2:
version "10.0.2"
resolved "https://codeload.github.com/codesandbox/babel-eslint/tar.gz/59308eb977bcd1a4cf1c98d29b019ca3a6546267"
dependencies:
"@babel/code-frame" "^7.0.0"
"@babel/parser" "^7.0.0"
Expand Down Expand Up @@ -8244,11 +8228,6 @@ d@1:
dependencies:
es5-ext "^0.10.9"

damerau-levenshtein@^1.0.0:
version "1.0.5"
resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.5.tgz#780cf7144eb2e8dbd1c3bb83ae31100ccc31a414"
integrity sha512-CBCRqFnpu715iPmw1KrdOrzRqbdFwQTwAWyyyYS42+iAgHCuXZ+/TdMgQkUENPomxEz9z1BEzuQU2Xw0kUuAgA==

damerau-levenshtein@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz#03191c432cb6eea168bb77f3a55ffdccb8978514"
Expand Down Expand Up @@ -9049,12 +9028,12 @@ emitter-mixin@0.0.3:
version "6.1.1"
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.1.1.tgz#c6cd0ec1b0642e2a3c67a1137efc5e796da4f88e"

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

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

eslint-plugin-jsx-a11y@^5.0.3:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-5.1.1.tgz#5c96bb5186ca14e94db1095ff59b3e2bd94069b1"
integrity sha512-5I9SpoP7gT4wBFOtXT8/tXNPYohHBVfyVfO17vkbC7r9kEIxYJF12D3pKqhk8+xnk12rfxKClS3WCFpVckFTPQ==
dependencies:
aria-query "^0.7.0"
array-includes "^3.0.3"
ast-types-flow "0.0.7"
axobject-query "^0.1.0"
damerau-levenshtein "^1.0.0"
emoji-regex "^6.1.0"
jsx-ast-utils "^1.4.0"

eslint-plugin-jsx-a11y@^6.0.3:
version "6.1.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.1.2.tgz#69bca4890b36dcf0fe16dd2129d2d88b98f33f88"
Expand All @@ -9550,6 +9516,20 @@ eslint-plugin-jsx-a11y@^6.0.3:
has "^1.0.3"
jsx-ast-utils "^2.0.1"

eslint-plugin-jsx-a11y@^6.1.0:
version "6.2.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.2.1.tgz#4ebba9f339b600ff415ae4166e3e2e008831cf0c"
integrity sha512-cjN2ObWrRz0TTw7vEcGQrx+YltMvZoOEx4hWU8eEERDnBIU00OTq7Vr+jA7DFKxiwLNv4tTh5Pq2GUNEa8b6+w==
dependencies:
aria-query "^3.0.0"
array-includes "^3.0.3"
ast-types-flow "^0.0.7"
axobject-query "^2.0.2"
damerau-levenshtein "^1.0.4"
emoji-regex "^7.0.2"
has "^1.0.3"
jsx-ast-utils "^2.0.1"

eslint-plugin-react-hooks@1.6.0, eslint-plugin-react-hooks@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-1.6.0.tgz#348efcda8fb426399ac7b8609607c7b4025a6f5f"
Expand Down Expand Up @@ -15463,11 +15443,6 @@ jsprim@^1.2.2:
json-schema "0.2.3"
verror "1.10.0"

jsx-ast-utils@^1.4.0:
version "1.4.1"
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1"
integrity sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=

jsx-ast-utils@^2.0.0, jsx-ast-utils@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz#e801b1b39985e20fffc87b40e3748080e2dcac7f"
Expand Down

0 comments on commit a432847

Please sign in to comment.