Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use prettier defaults #126

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
root: true,
extends: ['@webpack-contrib/eslint-config-webpack', 'prettier'],
};
root: true,
extends: ['@webpack-contrib/eslint-config-webpack', 'prettier']
}
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ module. Thankfully, Github provides a means to do this. Add a dependency to the

```json
{
"devDependencies": {
"thread-loader": "webpack-contrib/thread-loader#{id}/head"
}
"devDependencies": {
"thread-loader": "webpack-contrib/thread-loader#{id}/head"
}
}
```

Expand Down
1 change: 0 additions & 1 deletion .prettierrc.js

This file was deleted.

126 changes: 63 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,62 +40,62 @@ Use this loader only for expensive operations!

```js
module.exports = {
module: {
rules: [
{
test: /\.js$/,
include: path.resolve('src'),
use: [
'thread-loader',
// your expensive loader (e.g babel-loader)
],
},
],
},
};
module: {
rules: [
{
test: /\.js$/,
include: path.resolve('src'),
use: [
'thread-loader'
// your expensive loader (e.g babel-loader)
]
}
]
}
}
```

**with options**

```js
use: [
{
loader: 'thread-loader',
// loaders with equal options will share worker pools
options: {
// the number of spawned workers, defaults to (number of cpus - 1) or
// fallback to 1 when require('os').cpus() is undefined
workers: 2,

// number of jobs a worker processes in parallel
// defaults to 20
workerParallelJobs: 50,

// additional node.js arguments
workerNodeArgs: ['--max-old-space-size=1024'],

// Allow to respawn a dead worker pool
// respawning slows down the entire compilation
// and should be set to false for development
poolRespawn: false,

// timeout for killing the worker processes when idle
// defaults to 500 (ms)
// can be set to Infinity for watching builds to keep workers alive
poolTimeout: 2000,

// number of jobs the poll distributes to the workers
// defaults to 200
// decrease of less efficient but more fair distribution
poolParallelJobs: 50,

// name of the pool
// can be used to create different pools with elsewise identical options
name: 'my-pool',
},
},
// your expensive loader (e.g babel-loader)
];
{
loader: 'thread-loader',
// loaders with equal options will share worker pools
options: {
// the number of spawned workers, defaults to (number of cpus - 1) or
// fallback to 1 when require('os').cpus() is undefined
workers: 2,

// number of jobs a worker processes in parallel
// defaults to 20
workerParallelJobs: 50,

// additional node.js arguments
workerNodeArgs: ['--max-old-space-size=1024'],

// Allow to respawn a dead worker pool
// respawning slows down the entire compilation
// and should be set to false for development
poolRespawn: false,

// timeout for killing the worker processes when idle
// defaults to 500 (ms)
// can be set to Infinity for watching builds to keep workers alive
poolTimeout: 2000,

// number of jobs the poll distributes to the workers
// defaults to 200
// decrease of less efficient but more fair distribution
poolParallelJobs: 50,

// name of the pool
// can be used to create different pools with elsewise identical options
name: 'my-pool'
}
}
// your expensive loader (e.g babel-loader)
]
```

**prewarming**
Expand All @@ -105,21 +105,21 @@ To prevent the high delay when booting workers it possible to warmup the worker
This boots the max number of workers in the pool and loads specified modules into the node.js module cache.

```js
const threadLoader = require('thread-loader');
const threadLoader = require('thread-loader')

threadLoader.warmup(
{
// pool options, like passed to loader options
// must match loader options to boot the correct pool
},
[
// modules to load
// can be any module, i. e.
'babel-loader',
'babel-preset-es2015',
'sass-loader',
]
);
{
// pool options, like passed to loader options
// must match loader options to boot the correct pool
},
[
// modules to load
// can be any module, i. e.
'babel-loader',
'babel-preset-es2015',
'sass-loader'
]
)
```

## Contributing
Expand Down
34 changes: 17 additions & 17 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const MIN_BABEL_VERSION = 7;
const MIN_BABEL_VERSION = 7

module.exports = (api) => {
api.assertVersion(MIN_BABEL_VERSION);
api.cache(true);
module.exports = api => {
api.assertVersion(MIN_BABEL_VERSION)
api.cache(true)

return {
presets: [
[
'@babel/preset-env',
{
targets: {
node: '10.13.0',
},
},
],
],
};
};
return {
presets: [
[
'@babel/preset-env',
{
targets: {
node: '10.13.0'
}
}
]
]
}
}
4 changes: 2 additions & 2 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
extends: ['@commitlint/config-conventional']
}
60 changes: 30 additions & 30 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
/* eslint-disable import/no-unresolved */
// some file
import './style.scss?00';
import './style.scss?01';
import './style.scss?02';
import './style.scss?03';
import './style.scss?04';
import './style.scss?05';
import './style.scss?06';
import './style.scss?07';
import './style.scss?08';
import './style.scss?09';
import './style.scss?00'
import './style.scss?01'
import './style.scss?02'
import './style.scss?03'
import './style.scss?04'
import './style.scss?05'
import './style.scss?06'
import './style.scss?07'
import './style.scss?08'
import './style.scss?09'

import './style.scss?10';
import './style.scss?11';
import './style.scss?12';
import './style.scss?13';
import './style.scss?14';
import './style.scss?15';
import './style.scss?16';
import './style.scss?17';
import './style.scss?18';
import './style.scss?19';
import './style.scss?10'
import './style.scss?11'
import './style.scss?12'
import './style.scss?13'
import './style.scss?14'
import './style.scss?15'
import './style.scss?16'
import './style.scss?17'
import './style.scss?18'
import './style.scss?19'

import './style.scss?20';
import './style.scss?21';
import './style.scss?22';
import './style.scss?23';
import './style.scss?24';
import './style.scss?25';
import './style.scss?26';
import './style.scss?27';
import './style.scss?28';
import './style.scss?29';
import './style.scss?20'
import './style.scss?21'
import './style.scss?22'
import './style.scss?23'
import './style.scss?24'
import './style.scss?25'
import './style.scss?26'
import './style.scss?27'
import './style.scss?28'
import './style.scss?29'
Loading