Skip to content

Commit 9600af0

Browse files
style: use default prettier options (#137)
1 parent 80dbf18 commit 9600af0

29 files changed

+676
-677
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
root: true,
3-
extends: ['@webpack-contrib/eslint-config-webpack', 'prettier'],
3+
extends: ["@webpack-contrib/eslint-config-webpack", "prettier"],
44
};

.prettierrc.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Then add the plugin to your `webpack` config. For example:
2929
**file.js**
3030

3131
```js
32-
import css from 'file.css';
32+
import css from "file.css";
3333
```
3434

3535
**webpack.config.js**
@@ -40,8 +40,8 @@ module.exports = {
4040
rules: [
4141
{
4242
test: /\.js$/,
43-
enforce: 'pre',
44-
use: ['source-map-loader'],
43+
enforce: "pre",
44+
use: ["source-map-loader"],
4545
},
4646
],
4747
},
@@ -87,18 +87,18 @@ module.exports = {
8787
rules: [
8888
{
8989
test: /\.js$/,
90-
enforce: 'pre',
90+
enforce: "pre",
9191
use: [
9292
{
93-
loader: 'source-map-loader',
93+
loader: "source-map-loader",
9494
options: {
9595
filterSourceMappingUrl: (url, resourcePath) => {
9696
if (/broker-source-map-url\.js$/i.test(url)) {
9797
return false;
9898
}
9999

100100
if (/keep-source-mapping-url\.js$/i.test(resourcePath)) {
101-
return 'skip';
101+
return "skip";
102102
}
103103

104104
return true;
@@ -126,8 +126,8 @@ module.exports = {
126126
rules: [
127127
{
128128
test: /\.js$/,
129-
enforce: 'pre',
130-
use: ['source-map-loader'],
129+
enforce: "pre",
130+
use: ["source-map-loader"],
131131
},
132132
],
133133
},

babel.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ module.exports = (api) => {
77
return {
88
presets: [
99
[
10-
'@babel/preset-env',
10+
"@babel/preset-env",
1111
{
1212
targets: {
13-
node: '10.13.0',
13+
node: "10.13.0",
1414
},
1515
},
1616
],

commitlint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
extends: ['@commitlint/config-conventional'],
2+
extends: ["@commitlint/config-conventional"],
33
};

husky.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
hooks: {
3-
'pre-commit': 'lint-staged',
4-
'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS',
3+
"pre-commit": "lint-staged",
4+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
55
},
66
};

lint-staged.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
2-
'*.js': ['prettier --write', 'eslint --fix'],
3-
'*.{json,md,yml,css,ts}': ['prettier --write'],
2+
"*.js": ["eslint --fix", "prettier --write"],
3+
"*.{json,md,yml,css,ts}": ["prettier --write"],
44
};

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@
4949
"whatwg-mimetype": "^2.3.0"
5050
},
5151
"devDependencies": {
52-
"@babel/cli": "^7.12.1",
53-
"@babel/core": "^7.12.3",
54-
"@babel/preset-env": "^7.12.1",
52+
"@babel/cli": "^7.12.8",
53+
"@babel/core": "^7.12.9",
54+
"@babel/preset-env": "^7.12.7",
5555
"@commitlint/cli": "^11.0.0",
5656
"@commitlint/config-conventional": "^11.0.0",
5757
"@webpack-contrib/defaults": "^6.3.0",
5858
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
59-
"babel-jest": "^26.6.1",
60-
"cross-env": "^7.0.2",
59+
"babel-jest": "^26.6.3",
60+
"cross-env": "^7.0.3",
6161
"del": "^6.0.0",
6262
"del-cli": "^3.0.1",
63-
"eslint": "^7.12.0",
64-
"eslint-config-prettier": "^6.14.0",
63+
"eslint": "^7.14.0",
64+
"eslint-config-prettier": "^6.15.0",
6565
"eslint-plugin-import": "^2.22.1",
6666
"husky": "^4.3.0",
67-
"jest": "^26.6.1",
68-
"lint-staged": "^10.4.2",
67+
"jest": "^26.6.3",
68+
"lint-staged": "^10.5.2",
6969
"memfs": "^3.2.0",
7070
"npm-run-all": "^4.1.5",
71-
"prettier": "^2.1.2",
71+
"prettier": "^2.2.1",
7272
"standard-version": "^9.0.0",
7373
"webpack": "^5.9.0"
7474
},

src/cjs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const loader = require('./index');
1+
const loader = require("./index");
22

33
module.exports = loader.default;
44
module.exports.raw = loader.raw;

src/index.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
import path from 'path';
5+
import path from "path";
66

7-
import { getOptions } from 'loader-utils';
8-
import { validate } from 'schema-utils';
7+
import { getOptions } from "loader-utils";
8+
import { validate } from "schema-utils";
99

10-
import schema from './options.json';
11-
import { getSourceMappingURL, fetchFromURL, flattenSourceMap } from './utils';
10+
import schema from "./options.json";
11+
import { getSourceMappingURL, fetchFromURL, flattenSourceMap } from "./utils";
1212

1313
export default async function loader(input, inputMap) {
1414
const options = getOptions(this);
1515

1616
validate(schema, options, {
17-
name: 'Source Map Loader',
18-
baseDataPath: 'options',
17+
name: "Source Map Loader",
18+
baseDataPath: "options",
1919
});
2020

2121
const { sourceMappingURL, replacementString } = getSourceMappingURL(input);
@@ -32,9 +32,9 @@ export default async function loader(input, inputMap) {
3232

3333
try {
3434
behaviourSourceMappingUrl =
35-
typeof options.filterSourceMappingUrl !== 'undefined'
35+
typeof options.filterSourceMappingUrl !== "undefined"
3636
? options.filterSourceMappingUrl(sourceMappingURL, this.resourcePath)
37-
: 'consume';
37+
: "consume";
3838
} catch (error) {
3939
callback(error);
4040

@@ -43,12 +43,12 @@ export default async function loader(input, inputMap) {
4343

4444
// eslint-disable-next-line default-case
4545
switch (behaviourSourceMappingUrl) {
46-
case 'skip':
46+
case "skip":
4747
callback(null, input, inputMap);
4848
return;
4949
case false:
50-
case 'remove':
51-
callback(null, input.replace(replacementString, ''), inputMap);
50+
case "remove":
51+
callback(null, input.replace(replacementString, ""), inputMap);
5252
return;
5353
}
5454

@@ -76,7 +76,7 @@ export default async function loader(input, inputMap) {
7676
let map;
7777

7878
try {
79-
map = JSON.parse(sourceContent.replace(/^\)\]\}'/, ''));
79+
map = JSON.parse(sourceContent.replace(/^\)\]\}'/, ""));
8080
} catch (parseError) {
8181
this.emitWarning(
8282
new Error(
@@ -104,11 +104,11 @@ export default async function loader(input, inputMap) {
104104
let sourceContent;
105105

106106
const originalSourceContent =
107-
map.sourcesContent && typeof map.sourcesContent[i] !== 'undefined'
107+
map.sourcesContent && typeof map.sourcesContent[i] !== "undefined"
108108
? map.sourcesContent[i]
109109
: // eslint-disable-next-line no-undefined
110110
undefined;
111-
const skipReading = typeof originalSourceContent !== 'undefined';
111+
const skipReading = typeof originalSourceContent !== "undefined";
112112
let errored = false;
113113

114114
// We do not skipReading here, because we need absolute paths in sources.
@@ -150,8 +150,8 @@ export default async function loader(input, inputMap) {
150150
// eslint-disable-next-line no-shadow
151151
const { sourceURL, sourceContent } = source;
152152

153-
newMap.sources.push(sourceURL || '');
154-
newMap.sourcesContent.push(sourceContent || '');
153+
newMap.sources.push(sourceURL || "");
154+
newMap.sourcesContent.push(sourceContent || "");
155155
});
156156

157157
const sourcesContentIsEmpty =
@@ -161,5 +161,5 @@ export default async function loader(input, inputMap) {
161161
delete newMap.sourcesContent;
162162
}
163163

164-
callback(null, input.replace(replacementString, ''), newMap);
164+
callback(null, input.replace(replacementString, ""), newMap);
165165
}

0 commit comments

Comments
 (0)