Skip to content

Commit

Permalink
refactor: code
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Oct 4, 2019
1 parent abc7dca commit ba30e47
Show file tree
Hide file tree
Showing 18 changed files with 220 additions and 124 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
@@ -0,0 +1,4 @@
/coverage
/dist
/node_modules
/test/fixtures
15 changes: 9 additions & 6 deletions .eslintrc.js
@@ -1,9 +1,12 @@
module.exports = {
root: true,
plugins: ['prettier'],
extends: ['@webpack-contrib/eslint-config-webpack'],
rules: {
'prettier/prettier': ['error'],
strict: ['off'],
},
extends: ['@webpack-contrib/eslint-config-webpack', 'prettier'],
overrides: [
{
files: ['lib/**/*.js'],
parserOptions: {
sourceType: 'script',
},
},
],
};
8 changes: 8 additions & 0 deletions .github/CONTRIBUTING.md
Expand Up @@ -131,6 +131,14 @@ Migration: see webpack/webpack#5225
```

## Contributor License Agreement

When submitting your contribution, a CLA (Contributor License Agreement) bot will come by to verify that you signed the [CLA](https://cla.js.foundation/webpack/webpack-dev-middleware).
If it is your first time, it will link you to the right place to sign it.
However, if you have committed your contributions using an email that is not the same as your email used on GitHub, the CLA bot can't accept your contribution.

Run `git config user.email` to see your Git email, and verify it with [your GitHub email](https://github.com/settings/emails).

## Thanks

For your interest, time, understanding, and for following this simple guide.
19 changes: 9 additions & 10 deletions .github/ISSUE_TEMPLATE/BUG.md
@@ -1,7 +1,6 @@
---
name: 🐛 Bug Report
about: Something went awry and you'd like to tell us about it.

---

<!--
Expand All @@ -15,11 +14,11 @@ about: Something went awry and you'd like to tell us about it.
Head to StackOverflow or https://gitter.im/webpack/webpack.
-->

* Operating System:
* Node Version:
* NPM Version:
* webpack Version:
* webpack-dev-middleware Version:
- Operating System:
- Node Version:
- NPM Version:
- webpack Version:
- webpack-dev-middleware Version:

### Expected Behavior

Expand All @@ -32,13 +31,13 @@ about: Something went awry and you'd like to tell us about it.
### Code

```js
// webpack.config.js
// If your code blocks are over 20 lines, please paste a link to a gist
// (https://gist.github.com).
// webpack.config.js
// If your code blocks are over 20 lines, please paste a link to a gist
// (https://gist.github.com).
```

```js
// additional code, HEY YO remove this block if you don't need it
// additional code, HEY YO remove this block if you don't need it
```

### How Do We Reproduce?
Expand Down
4 changes: 1 addition & 3 deletions .github/ISSUE_TEMPLATE/DOCS.md
@@ -1,7 +1,6 @@
---
name: 📚 Documentation
about: Are the docs lacking or missing something? Do they need some new 🔥 hotness? Tell us here.

---

<!--
Expand All @@ -26,5 +25,4 @@ Documentation Is:

### Please Explain in Detail...


### Your Proposal for Changes
### Your Proposal for Changes
13 changes: 5 additions & 8 deletions .github/ISSUE_TEMPLATE/FEATURE.md
@@ -1,7 +1,6 @@
---
name: ✨ Feature Request
about: Suggest an idea for this project

---

<!--
Expand All @@ -15,14 +14,12 @@ about: Suggest an idea for this project
Head to StackOverflow or https://gitter.im/webpack/webpack.
-->

* Operating System:
* Node Version:
* NPM Version:
* webpack Version:
* webpack-dev-middleware Version:
- Operating System:
- Node Version:
- NPM Version:
- webpack Version:
- webpack-dev-middleware Version:

### Feature Proposal



### Feature Use Case
16 changes: 5 additions & 11 deletions .github/ISSUE_TEMPLATE/MODIFICATION.md
@@ -1,7 +1,6 @@
---
name: 🔧 Modification Request
about: Would you like something work differently? Have an alternative approach? This is the template for you.

---

<!--
Expand All @@ -15,19 +14,14 @@ about: Would you like something work differently? Have an alternative approach?
Head to StackOverflow or https://gitter.im/webpack/webpack.
-->

* Operating System:
* Node Version:
* NPM Version:
* webpack Version:
* webpack-dev-middleware Version:

- Operating System:
- Node Version:
- NPM Version:
- webpack Version:
- webpack-dev-middleware Version:

### Expected Behavior / Situation



### Actual Behavior / Situation



### Modification Proposal
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/SUPPORT.md
@@ -1,9 +1,8 @@
---
name: 🆘 Support, Help, and Advice
about: 👉🏽 Need support, help, or advice? Don't open an issue! Head to StackOverflow or https://gitter.im/webpack/webpack.

---

Hey there! If you need support, help, or advice then this is not the place to ask.
Please visit [StackOverflow](https://stackoverflow.com/questions/tagged/webpack)
or [the Webpack Gitter](https://gitter.im/webpack/webpack) instead.
or [the Webpack Gitter](https://gitter.im/webpack/webpack) instead.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -32,4 +32,4 @@ This PR contains a:
migration path for existing applications.
-->

### Additional Info
### Additional Info
6 changes: 4 additions & 2 deletions .prettierignore
@@ -1,3 +1,5 @@
coverage
node_modules
/coverage
/dist
/node_modules
/test/fixtures
CHANGELOG.md
4 changes: 3 additions & 1 deletion lib/DevMiddlewareError.js
@@ -1,3 +1,5 @@
'use strict';

module.exports = class DevMiddlewareError extends Error {};
class DevMiddlewareError extends Error {}

module.exports = DevMiddlewareError;
6 changes: 3 additions & 3 deletions index.js → lib/index.js
Expand Up @@ -2,8 +2,8 @@

const mime = require('mime');

const middleware = require('./lib/middleware');
const reporter = require('./lib/utils/reporter');
const middleware = require('./middleware');
const reporter = require('./utils/reporter');
const {
setupHooks,
setupRebuild,
Expand All @@ -12,7 +12,7 @@ const {
setupOutputFileSystem,
getFilenameFromUrl,
ready,
} = require('./lib/utils');
} = require('./utils');

const noop = () => {};

Expand Down
2 changes: 2 additions & 0 deletions lib/utils/index.js
@@ -1,3 +1,5 @@
'use strict';

const getFilenameFromUrl = require('./getFilenameFromUrl');
const handleRangeHeaders = require('./handleRangeHeaders');
const ready = require('./ready');
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/setupHooks.js
@@ -1,3 +1,5 @@
'use strict';

function setupHooks(context) {
function invalid(callback) {
if (context.state) {
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/setupLogger.js
@@ -1,3 +1,5 @@
'use strict';

const weblog = require('webpack-log');

function setupLogger(context) {
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/setupRebuild.js
@@ -1,3 +1,5 @@
'use strict';

function setupRebuild(context) {
function rebuild() {
if (context.state) {
Expand Down

0 comments on commit ba30e47

Please sign in to comment.