Skip to content

Commit 7d4a47b

Browse files
committed
Enable linting for common and sandbox
1 parent aa145a8 commit 7d4a47b

File tree

95 files changed

+291
-550
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+291
-550
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"arrow-parens": 0,
2424
"import/prefer-default-export": 0,
2525
"class-methods-use-this": 0,
26-
"no-console": ["error", { "allow": ["error"] }],
26+
"no-console": ["error", { "allow": ["error", "warn"] }],
2727
"prefer-template": "off",
2828
"no-plusplus": 0,
2929
"no-underscore-dangle": "off",

packages/app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
"test": "jest --env=jsdom",
2222
"test:watch": "jest --watch --env=jsdom",
2323
"test:integrations": "jest --config integration-tests/jest.config.json --maxWorkers=2",
24-
"lint": "npm run lint:app && npm run lint:embed",
24+
"lint": "npm run lint:app && npm run lint:embed && npm run lint:sandbox",
2525
"lint:app": "cross-env LINT=1 eslint --ext .js,.ts,.tsx src/app",
2626
"lint:embed": "cross-env LINT=1 eslint --ext .js,.ts,.tsx src/embed",
27+
"lint:sandbox": "cross-env LINT=1 eslint --ext .js,.ts,.tsx src/sandbox",
2728
"integrations:start": "docker run -v $(pwd):/app/ -it codesandbox/test yarn start:test",
2829
"typecheck": "tsc --noEmit -p tsconfig.check.json"
2930
},

packages/app/src/sandbox/compile-old.js

Lines changed: 0 additions & 288 deletions
This file was deleted.

packages/app/src/sandbox/compile.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import parseConfigurations from '@codesandbox/common/lib/templates/configuration
66
import initializeErrorTransformers from 'sandbox-hooks/errors/transformers';
77
import { inject, unmount } from 'sandbox-hooks/react-error-overlay/overlay';
88
import { isBabel7 } from '@codesandbox/common/lib/utils/is-babel-7';
9+
import { ParsedConfigurationFiles } from '@codesandbox/common/lib/templates/template';
910
import getDefinition, {
1011
TemplateType,
1112
} from '@codesandbox/common/lib/templates/index';
@@ -31,7 +32,6 @@ import { consumeCache, saveCache, deleteAPICache } from './eval/cache';
3132

3233
import { showRunOnClick } from './status-screen/run-on-click';
3334
import { Module } from './eval/entities/module';
34-
import { ParsedConfigurationFiles } from '@codesandbox/common/lib/templates/template';
3535
import TranspiledModule from './eval/transpiled-module';
3636

3737
let initializedResizeListener = false;
@@ -64,8 +64,11 @@ export function getHTMLParts(html: string) {
6464
return { head: '', body: html };
6565
}
6666

67-
function sendTestCount(manager: Manager, modules: { [path: string]: Module }) {
68-
const testRunner = manager.testRunner;
67+
function sendTestCount(
68+
givenManager: Manager,
69+
modules: { [path: string]: Module }
70+
) {
71+
const testRunner = givenManager.testRunner;
6972
const tests = testRunner.findTests(modules);
7073

7174
dispatch({
@@ -623,6 +626,7 @@ async function compile({
623626
try {
624627
await evalBoilerplates(defaultBoilerplates);
625628
} catch (e) {
629+
// eslint-disable-next-line no-console
626630
console.log("Couldn't load all boilerplates: " + e.message);
627631
}
628632
}
@@ -674,6 +678,7 @@ async function compile({
674678
}
675679
}, 600);
676680
} catch (e) {
681+
// eslint-disable-next-line no-console
677682
console.log('Error in sandbox:');
678683
console.error(e);
679684

packages/app/src/sandbox/eval/cache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export async function saveCache(
5151
firstRun: boolean
5252
) {
5353
if (!sandboxId) {
54-
return;
54+
return Promise.resolve(false);
5555
}
5656

5757
const managerState = {

packages/app/src/sandbox/eval/loaders/@babel-runtime.no-webpack.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/app/src/sandbox/eval/loaders/dependency-resolver.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import DependencyNotFoundError from 'sandbox-hooks/errors/dependency-not-found-e
99
*/
1010
export default function getDependency(dependencyPath: string) {
1111
if (dependencyPath === 'codesandbox-api') {
12+
// eslint-disable-next-line
1213
return require('codesandbox-api');
1314
}
1415

packages/app/src/sandbox/eval/loaders/utils/process.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable */
12
// from https://unpkg.com/[email protected]/browser.js
23

34
const process = {};

0 commit comments

Comments
 (0)