Skip to content

Commit

Permalink
chore(lint): apply prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Oct 22, 2020
1 parent 1725a62 commit d009008
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 48 deletions.
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ lerna.json
/website/.cache/
/website/public/
__testfixtures__/
examples/*/public
examples/*/public
**/dist/
**/lib/
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import React from 'react'

const G = ({prefix}) => (
<span className="my-cool-class">
{prefix}
{' '}
- G
</span>
)
const G = ({ prefix }) => <span className="my-cool-class">{prefix} - G</span>

export default G
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ const getConfig = target => ({
],
},
externals:
target === 'async-node' ? ['@loadable/component', nodeExternals()] : undefined,
target === 'async-node'
? ['@loadable/component', nodeExternals()]
: undefined,
output: {
path: path.join(DIST_PATH, target),
filename: production ? '[name]-bundle-[chunkhash:8].js' : '[name].js',
Expand Down
8 changes: 4 additions & 4 deletions examples/typescript/src/client/main-web.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { hydrate } from 'react-dom'
import { loadableReady } from '@loadable/component'
import App from './App.tsx'

console.log('waiting for application ready...');
console.log('waiting for application ready...')
loadableReady(() => {
console.log('application is ready...');
const root = document.getElementById('main');
console.log('application is ready...')
const root = document.getElementById('main')
hydrate(<App />, root)
});
})
2 changes: 1 addition & 1 deletion examples/typescript/src/server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react'
import { renderToString } from 'react-dom/server'
import { ChunkExtractor } from '@loadable/server'

const app = express();
const app = express()

// https://github.com/gregberge/loadable-components/issues/634
// app.use('*/runtime~main.js', async (req, res, next) => {
Expand Down
10 changes: 5 additions & 5 deletions examples/typescript/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
Expand All @@ -25,7 +25,7 @@
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */

/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
Expand All @@ -48,7 +48,7 @@
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */

Expand All @@ -63,7 +63,7 @@
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */

/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"skipLibCheck": true /* Skip type checking of declaration files. */,
"forceConsistentCasingInFileNames": true,
/* Disallow inconsistently-cased references to the same file. */
"jsx": "react"
Expand Down
4 changes: 2 additions & 2 deletions examples/typescript/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import MiniCssExtractPlugin from 'mini-css-extract-plugin'

const DIST_PATH = path.resolve(__dirname, 'public/dist')
const production = process.env.NODE_ENV === 'production'
const development = !production;
const development = !production

const getConfig = target => ({
name: target,
Expand Down Expand Up @@ -43,7 +43,7 @@ const getConfig = target => ({
},

resolve: {
extensions: [ '.tsx', '.ts', '.js', '.css' ],
extensions: ['.tsx', '.ts', '.js', '.css'],
},

output: {
Expand Down
2 changes: 1 addition & 1 deletion examples/webpack/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
these examples are also __tests__
these examples are also **tests**
9 changes: 6 additions & 3 deletions examples/webpack/webpack4/src/client/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ const Moment = loadable.lib(() => import('moment'), {
const App = () => (
<div>
<p>
Lazy load letter A:<X letter="A" />
Lazy load letter A:
<X letter="A" />
</p>
<p>
Lazy load letter C:<X letter="B" />
Lazy load letter C:
<X letter="B" />
</p>
<p>
Lazy load letter only on Client C:<ClientSideOnly letter="C" />
Lazy load letter only on Client C:
<ClientSideOnly letter="C" />
</p>
<p>
lazy load momentjs:
Expand Down
8 changes: 4 additions & 4 deletions examples/webpack/webpack4/src/client/main-web.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { hydrate } from 'react-dom'
import { loadableReady } from '@loadable/component'
import App from './App'

console.log('waiting for application ready...');
console.log('waiting for application ready...')
loadableReady(() => {
console.log('application is ready...');
const root = document.getElementById('main');
console.log('application is ready...')
const root = document.getElementById('main')
hydrate(<App />, root)
});
})
18 changes: 9 additions & 9 deletions examples/webpack/webpack4/src/server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import React from 'react'
import { renderToString } from 'react-dom/server'
import { ChunkExtractor } from '@loadable/server'

const app = express();
const app = express()

// https://github.com/gregberge/loadable-components/issues/634
app.use('*/runtime~main*.js', async (req, res, next) => {
console.log('delaying runtime chunk');
await new Promise(resolve => setTimeout(resolve, 2000));
next();
});
console.log('delaying runtime chunk')
await new Promise(resolve => setTimeout(resolve, 2000))
next()
})

app.use('*/letters*.js', async (req, res, next) => {
console.log('delaying letters chunk');
await new Promise(resolve => setTimeout(resolve, 1000));
next();
});
console.log('delaying letters chunk')
await new Promise(resolve => setTimeout(resolve, 1000))
next()
})

app.use(express.static(path.join(__dirname, '../../public')))

Expand Down
2 changes: 1 addition & 1 deletion examples/webpack/webpack4/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import MiniCssExtractPlugin from 'mini-css-extract-plugin'

const DIST_PATH = path.resolve(__dirname, 'public/dist')
const production = process.env.NODE_ENV === 'production'
const development = !production;
const development = !production

const getConfig = target => ({
name: target,
Expand Down
3 changes: 2 additions & 1 deletion examples/webpack/webpack5/src/client/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const Moment = loadable.lib(() => import('moment'), {
const App = () => (
<div>
<p>
Lazy load letter A:<X letter="A" />
Lazy load letter A:
<X letter="A" />
</p>
<p>
lazy load momentjs:
Expand Down
8 changes: 4 additions & 4 deletions examples/webpack/webpack5/src/client/main-web.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { hydrate } from 'react-dom'
import { loadableReady } from '@loadable/component'
import App from './App'

console.log('waiting for application ready...');
console.log('waiting for application ready...')
loadableReady(() => {
console.log('application is ready...');
const root = document.getElementById('main');
console.log('application is ready...')
const root = document.getElementById('main')
hydrate(<App />, root)
});
})
2 changes: 1 addition & 1 deletion examples/webpack/webpack5/src/server/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react'
import { renderToString } from 'react-dom/server'
import { ChunkExtractor } from '@loadable/server'

const app = express();
const app = express()

// https://github.com/gregberge/loadable-components/issues/634
// app.use('*/runtime~main.js', async (req, res, next) => {
Expand Down
2 changes: 1 addition & 1 deletion examples/webpack/webpack5/webpack.config.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import MiniCssExtractPlugin from 'mini-css-extract-plugin'

const DIST_PATH = path.resolve(__dirname, 'public/dist')
const production = process.env.NODE_ENV === 'production'
const development = !production;
const development = !production

const getConfig = target => ({
name: target,
Expand Down
2 changes: 1 addition & 1 deletion packages/component/src/createLoadable.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function createLoadable({
if (ctor.resolve) {
return ctor.resolve(props)
}
return "static"
return 'static'
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/component/src/loadableReady.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ export default function loadableReady(
}

checkReadyState()
}).then(done);
}).then(done)
}

0 comments on commit d009008

Please sign in to comment.