Skip to content

Commit 940c967

Browse files
byzykjeremenichelli
authored andcommitted
add singlequotes rule, autofix examples
1 parent 6e74948 commit 940c967

33 files changed

+234
-234
lines changed

.eslintrc

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@
3030
"overrides": [
3131
{
3232
"files": ["src/content/**/*.md"],
33-
"parserOptions": {
34-
"codeFrame": true,
35-
},
3633
"rules": {
3734
"indent": ["error", 2],
35+
"quotes": ["error", "single"],
3836
"no-undef": 0,
3937
"no-constant-condition": 0,
4038
"no-useless-escape": 0,

src/content/api/loaders.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ module.exports = function(content) {
147147

148148
module.exports.pitch = function(remainingRequest, precedingRequest, data) {
149149
if (someCondition()) {
150-
return "module.exports = require(" + JSON.stringify("-!" + remainingRequest) + ");";
150+
return 'module.exports = require(' + JSON.stringify('-!' + remainingRequest) + ');';
151151
}
152152
};
153153
```
@@ -171,7 +171,7 @@ Given the following example this require call is used:
171171
In `/abc/file.js`:
172172

173173
``` js
174-
require("./loader1?xyz!loader2!./resource?rrr");
174+
require('./loader1?xyz!loader2!./resource?rrr');
175175
```
176176

177177

@@ -270,15 +270,15 @@ In the example:
270270
``` js
271271
[
272272
{
273-
request: "/abc/loader1.js?xyz",
274-
path: "/abc/loader1.js",
275-
query: "?xyz",
273+
request: '/abc/loader1.js?xyz',
274+
path: '/abc/loader1.js',
275+
query: '?xyz',
276276
module: [Function]
277277
},
278278
{
279-
request: "/abc/node_modules/loader2/index.js",
280-
path: "/abc/node_modules/loader2/index.js",
281-
query: "",
279+
request: '/abc/node_modules/loader2/index.js',
280+
path: '/abc/node_modules/loader2/index.js',
281+
query: '',
282282
module: [Function]
283283
}
284284
];

src/content/api/module-methods.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ require(dependency: String);
129129
Synchronously retrieve the exports from another module. The compiler will ensure that the dependency is available in the output bundle.
130130

131131
``` javascript
132-
var $ = require("jquery");
133-
var myModule = require("my-module");
132+
var $ = require('jquery');
133+
var myModule = require('my-module');
134134
```
135135

136136
W> Using it asynchronously may not have the expected effect.
@@ -154,19 +154,19 @@ Multiple requires to the same module result in only one module execution and onl
154154
W> This is only needed in rare cases for compatibility!
155155

156156
``` javascript
157-
var d1 = require("dependency");
158-
require("dependency") === d1;
159-
delete require.cache[require.resolve("dependency")];
160-
require("dependency") !== d1;
157+
var d1 = require('dependency');
158+
require('dependency') === d1;
159+
delete require.cache[require.resolve('dependency')];
160+
require('dependency') !== d1;
161161
```
162162

163163
``` javascript
164164
// in file.js
165165
require.cache[module.id] === module;
166-
require("./file.js") === module.exports;
166+
require('./file.js') === module.exports;
167167
delete require.cache[module.id];
168168
require.cache[module.id] === undefined;
169-
require("./file.js") !== module.exports; // in theory; in praxis this causes a stack overflow
169+
require('./file.js') !== module.exports; // in theory; in praxis this causes a stack overflow
170170
require.cache[module.id] !== module;
171171
```
172172

@@ -277,7 +277,7 @@ W> This feature relies on [`Promise`](https://developer.mozilla.org/en-US/docs/W
277277

278278
``` javascript
279279
require(['b'], function(b) {
280-
var c = require("c");
280+
var c = require('c');
281281
});
282282
```
283283

src/content/api/module-variables.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Indicates whether or not [Hot Module Replacement](/concepts/hot-module-replaceme
3333
The ID of the current module.
3434

3535
``` javascript
36-
module.id === require.resolve("./file.js");
36+
module.id === require.resolve('./file.js');
3737
```
3838

3939

src/content/api/node.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ npm install --save-dev webpack
2323
Then require the webpack module in your Node.js script:
2424

2525
``` js
26-
const webpack = require("webpack");
26+
const webpack = require('webpack');
2727
```
2828

2929
Or if you prefer ES2015:
3030

3131
``` js
32-
import webpack from "webpack";
32+
import webpack from 'webpack';
3333
```
3434

3535

@@ -150,7 +150,7 @@ The `watch` method returns a `Watching` instance that exposes
150150

151151
``` js
152152
watching.close(() => {
153-
console.log("Watching Ended.");
153+
console.log('Watching Ended.');
154154
});
155155
```
156156

@@ -332,16 +332,16 @@ replace the default `outputFileSystem` with
332332
instead of to disk:
333333

334334
``` js
335-
const MemoryFS = require("memory-fs");
336-
const webpack = require("webpack");
335+
const MemoryFS = require('memory-fs');
336+
const webpack = require('webpack');
337337

338338
const fs = new MemoryFS();
339339
const compiler = webpack({ /* options*/ });
340340

341341
compiler.outputFileSystem = fs;
342342
compiler.run((err, stats) => {
343343
// Read the output later:
344-
const content = fs.readFileSync("...");
344+
const content = fs.readFileSync('...');
345345
});
346346
```
347347

src/content/concepts/module-resolution.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ Using `enhanced-resolve`, webpack can resolve three kinds of file paths:
2929
### Absolute paths
3030

3131
```js
32-
import "/home/me/file";
32+
import '/home/me/file';
3333

34-
import "C:\\Users\\me\\file";
34+
import 'C:\\Users\\me\\file';
3535
```
3636

3737
Since we already have the absolute path to the file, no further resolution is required.
@@ -40,8 +40,8 @@ Since we already have the absolute path to the file, no further resolution is re
4040
### Relative paths
4141

4242
```js
43-
import "../src/file1";
44-
import "./file2";
43+
import '../src/file1';
44+
import './file2';
4545
```
4646

4747
In this case, the directory of the resource file where the `import` or `require` occurs is taken to be the context directory. The relative path specified in the `import/require` is joined to this context path to produce the absolute path to the module.
@@ -50,8 +50,8 @@ In this case, the directory of the resource file where the `import` or `require`
5050
### Module paths
5151

5252
```js
53-
import "module";
54-
import "module/lib/file";
53+
import 'module';
54+
import 'module/lib/file';
5555
```
5656

5757
Modules are searched for inside all directories specified in [`resolve.modules`](/configuration/resolve/#resolve-modules).

src/content/concepts/plugins.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ contributors:
66
- jhnns
77
- rouzbeh84
88
- johnstew
9+
- byzyk
910
---
1011

1112
**Plugins** are the [backbone](https://github.com/webpack/tapable) of webpack. webpack itself is built on the **same plugin system** that you use in your webpack configuration!
@@ -25,7 +26,7 @@ const pluginName = 'ConsoleLogOnBuildWebpackPlugin';
2526
class ConsoleLogOnBuildWebpackPlugin {
2627
apply(compiler) {
2728
compiler.hooks.run.tap(pluginName, compilation => {
28-
console.log("The webpack build process is starting!!!");
29+
console.log('The webpack build process is starting!!!');
2930
});
3031
}
3132
}

src/content/configuration/dev-server.md

+27-27
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This set of options is picked up by [webpack-dev-server](https://github.com/webp
2727
module.exports = {
2828
//...
2929
devServer: {
30-
contentBase: path.join(__dirname, "dist"),
30+
contentBase: path.join(__dirname, 'dist'),
3131
compress: true,
3232
port: 9000
3333
}
@@ -164,7 +164,7 @@ You can prevent all these messages from showing, by using this option:
164164
module.exports = {
165165
//...
166166
devServer: {
167-
clientLogLevel: "none"
167+
clientLogLevel: 'none'
168168
}
169169
};
170170
```
@@ -223,7 +223,7 @@ By default it will use your current working directory to serve content, but you
223223
module.exports = {
224224
//...
225225
devServer: {
226-
contentBase: path.join(__dirname, "public")
226+
contentBase: path.join(__dirname, 'public')
227227
}
228228
};
229229
```
@@ -236,7 +236,7 @@ It is also possible to serve from multiple directories:
236236
module.exports = {
237237
//...
238238
devServer: {
239-
contentBase: [path.join(__dirname, "public"), path.join(__dirname, "assets")]
239+
contentBase: [path.join(__dirname, 'public'), path.join(__dirname, 'assets')]
240240
}
241241
};
242242
```
@@ -295,7 +295,7 @@ module.exports = {
295295
//...
296296
devServer: {
297297
lazy: true,
298-
filename: "bundle.js"
298+
filename: 'bundle.js'
299299
}
300300
};
301301
```
@@ -316,7 +316,7 @@ module.exports = {
316316
//...
317317
devServer: {
318318
headers: {
319-
"X-Custom-Foo": "bar"
319+
'X-Custom-Foo': 'bar'
320320
}
321321
}
322322
};
@@ -387,7 +387,7 @@ Specify a host to use. By default this is `localhost`. If you want your server t
387387
module.exports = {
388388
//...
389389
devServer: {
390-
host: "0.0.0.0"
390+
host: '0.0.0.0'
391391
}
392392
};
393393
```
@@ -461,9 +461,9 @@ module.exports = {
461461
//...
462462
devServer: {
463463
https: {
464-
key: fs.readFileSync("/path/to/server.key"),
465-
cert: fs.readFileSync("/path/to/server.crt"),
466-
ca: fs.readFileSync("/path/to/ca.pem"),
464+
key: fs.readFileSync('/path/to/server.key'),
465+
cert: fs.readFileSync('/path/to/server.crt'),
466+
ca: fs.readFileSync('/path/to/ca.pem'),
467467
}
468468
}
469469
};
@@ -739,7 +739,7 @@ module.exports = {
739739
//...
740740
devServer: {
741741
proxy: {
742-
"/api": "http://localhost:3000"
742+
'/api': 'http://localhost:3000'
743743
}
744744
}
745745
};
@@ -754,9 +754,9 @@ module.exports = {
754754
//...
755755
devServer: {
756756
proxy: {
757-
"/api": {
758-
target: "http://localhost:3000",
759-
pathRewrite: {"^/api" : ""}
757+
'/api': {
758+
target: 'http://localhost:3000',
759+
pathRewrite: {'^/api' : ''}
760760
}
761761
}
762762
}
@@ -770,8 +770,8 @@ module.exports = {
770770
//...
771771
devServer: {
772772
proxy: {
773-
"/api": {
774-
target: "https://other-server.example.com",
773+
'/api': {
774+
target: 'https://other-server.example.com',
775775
secure: false
776776
}
777777
}
@@ -790,12 +790,12 @@ module.exports = {
790790
//...
791791
devServer: {
792792
proxy: {
793-
"/api": {
794-
target: "http://localhost:3000",
793+
'/api': {
794+
target: 'http://localhost:3000',
795795
bypass: function(req, res, proxyOptions) {
796-
if (req.headers.accept.indexOf("html") !== -1) {
797-
console.log("Skipping proxy for browser request.");
798-
return "/index.html";
796+
if (req.headers.accept.indexOf('html') !== -1) {
797+
console.log('Skipping proxy for browser request.');
798+
return '/index.html';
799799
}
800800
}
801801
}
@@ -811,8 +811,8 @@ module.exports = {
811811
//...
812812
devServer: {
813813
proxy: [{
814-
context: ["/auth", "/api"],
815-
target: "http://localhost:3000",
814+
context: ['/auth', '/api'],
815+
target: 'http://localhost:3000',
816816
}]
817817
}
818818
};
@@ -858,7 +858,7 @@ For example, the dev-server is proxied by nginx, and available on `myapp.test`:
858858
module.exports = {
859859
//...
860860
devServer: {
861-
public: "myapp.test:80"
861+
public: 'myapp.test:80'
862862
}
863863
};
864864
```
@@ -884,7 +884,7 @@ The `publicPath` can be changed so the bundle is put in a directory:
884884
module.exports = {
885885
//...
886886
devServer: {
887-
publicPath: "/assets/"
887+
publicPath: '/assets/'
888888
}
889889
};
890890
```
@@ -899,7 +899,7 @@ It is also possible to use a full URL. This is necessary for Hot Module Replacem
899899
module.exports = {
900900
//...
901901
devServer: {
902-
publicPath: "http://localhost:8080/assets/"
902+
publicPath: 'http://localhost:8080/assets/'
903903
}
904904
};
905905
```
@@ -1006,7 +1006,7 @@ To show only errors in your bundle:
10061006
module.exports = {
10071007
//...
10081008
devServer: {
1009-
stats: "errors-only"
1009+
stats: 'errors-only'
10101010
}
10111011
};
10121012
```

src/content/configuration/entry-context.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The base directory, an **absolute path**, for resolving entry points and loaders
2020
``` js
2121
module.exports = {
2222
//...
23-
context: path.resolve(__dirname, "app")
23+
context: path.resolve(__dirname, 'app')
2424
};
2525
```
2626

@@ -43,9 +43,9 @@ Simple rule: one entry point per HTML page. SPA: one entry point, MPA: multiple
4343
module.exports = {
4444
//...
4545
entry: {
46-
home: "./home.js",
47-
about: "./about.js",
48-
contact: "./contact.js"
46+
home: './home.js',
47+
about: './about.js',
48+
contact: './contact.js'
4949
}
5050
};
5151
```

0 commit comments

Comments
 (0)