Skip to content

Commit d41de4e

Browse files
committed
Adding LICENSE headers and also linting the test directory
1 parent 3cf680f commit d41de4e

26 files changed

+230
-16
lines changed

.eslintrc.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
"root": true,
3-
"plugins": ["node"],
3+
"plugins": ["node", "header"],
44
"extends": ["eslint:recommended", "plugin:node/recommended"],
55
"env": {
66
"node": true,
@@ -53,7 +53,8 @@ module.exports = {
5353
],
5454
"node/no-unpublished-bin": "error",
5555
"node/no-unpublished-require": "error",
56-
"node/process-exit-as-throw": "error"
56+
"node/process-exit-as-throw": "error",
57+
"header/header": [2, "block", {"pattern": "This file is part of the Symfony package"}]
5758
}
5859
};
5960

bin/encore.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
#!/usr/bin/env node
2+
/*
3+
* This file is part of the Symfony package.
4+
*
5+
* (c) Fabien Potencier <fabien@symfony.com>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
211
'use strict';
312

413
const path = require('path');

lib/DeleteUnusedEntriesJSPlugin.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const path = require('path');

lib/WebpackConfig.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const path = require('path');
@@ -155,11 +164,11 @@ class WebpackConfig {
155164

156165
configureBabel(callback) {
157166
if (typeof callback !== 'function') {
158-
throw new Error(`Argument 1 to configureBabel() must be a callback function.`);
167+
throw new Error('Argument 1 to configureBabel() must be a callback function.');
159168
}
160169

161170
if (this.doesBabelRcFileExist()) {
162-
throw new Error(`configureBabel() cannot be called because your app has a .babelrc file. Either put all of your Babel configuration in that file, or delete it and use this function.`);
171+
throw new Error('configureBabel() cannot be called because your app has a .babelrc file. Either put all of your Babel configuration in that file, or delete it and use this function.');
163172
}
164173

165174
this.babelConfigurationCallback = callback;

lib/config-generator.js

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const webpack = require('webpack');
@@ -85,7 +94,7 @@ class ConfigGenerator {
8594
}
8695

8796
buildRulesConfig() {
88-
var cssLoaders = [
97+
const cssLoaders = [
8998
{
9099
loader: 'css-loader' + this.getSourceMapOption(),
91100
},
@@ -138,7 +147,7 @@ class ConfigGenerator {
138147
);
139148
}
140149

141-
var rules = [];
150+
let rules = [];
142151
rules.push({
143152
// match .js and .jsx
144153
test: /\.jsx?$/,
@@ -236,7 +245,7 @@ class ConfigGenerator {
236245
*/
237246
plugins.push(new ExtractTextPlugin({
238247
filename: this.webpackConfig.useVersioning ? '[name].[contenthash].css' : '[name].css',
239-
// if true, async CSS (e.g. loaded via react.ensure())
248+
// if true, async CSS (e.g. loaded via require.ensure())
240249
// is extracted to the entry point CSS. If false, it's
241250
// inlined in the AJAX-loaded .js file.
242251
allChunks: false
@@ -270,7 +279,7 @@ class ConfigGenerator {
270279
* But as soon as this plugin is included
271280
* at all, SASS begins to have errors, until the context
272281
* and output options are specified. At this time, I'm
273-
* quite unsure what's going on here
282+
* not totally sure what's going on here
274283
* https://github.com/jtangelder/sass-loader/issues/285
275284
*/
276285
plugins.push(new webpack.LoaderOptionsPlugin({

lib/config/RuntimeConfig.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
class RuntimeConfig {

lib/config/parse-runtime.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const RuntimeConfig = require('./RuntimeConfig');

lib/config/validator.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
class Validator {

lib/context.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
/**

lib/friendly-errors/formatters/missing-loader.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const chalk = require('chalk');

lib/friendly-errors/formatters/missing-postcss-config.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const chalk = require('chalk');

lib/friendly-errors/transformers/missing-loader.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const TYPE = 'loader-not-enabled';

lib/friendly-errors/transformers/missing-postcss-config.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const TYPE = 'missing-postcss-config';

lib/loader-features.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const packageHelper = require('./package-helper');

lib/package-helper.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const chalk = require('chalk');

lib/test/assert.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const path = require('path');

lib/test/setup.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const path = require('path');

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"test": "./node_modules/.bin/mocha --reporter spec test --recursive",
8-
"lint": "./node_modules/.bin/eslint lib",
8+
"lint": "./node_modules/.bin/eslint lib test",
99
"travis:lint": "npm run lint && npm run nsp",
1010
"nsp": "./node_modules/.bin/nsp check --output summary"
1111
},
@@ -53,6 +53,7 @@
5353
"chai": "^3.5.0",
5454
"chai-fs": "^1.0.0",
5555
"eslint": "^3.19.0",
56+
"eslint-plugin-header": "^1.0.0",
5657
"eslint-plugin-node": "^4.2.2",
5758
"http-server": "^0.9.0",
5859
"less": "^2.7.2",

test/.eslintrc.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
"env": {
3+
"node": true,
4+
"mocha": true
5+
}
6+
};

test/WebpackConfig.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const expect = require('chai').expect;

test/config-generator.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const expect = require('chai').expect;
@@ -42,7 +51,7 @@ function findPlugin(pluginConstructor, plugins) {
4251
*/
4352
function findRule(regex, rules) {
4453
for (let rule of rules) {
45-
if (rule.test.toString() == regex.toString()) {
54+
if (rule.test.toString() === regex.toString()) {
4655
return rule;
4756
}
4857
}

test/config/parse-runtime.js

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <fabien@symfony.com>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
'use strict';
211

312
const expect = require('chai').expect;
@@ -6,11 +15,11 @@ const testSetup = require('../../lib/test/setup');
615
const fs = require('fs-extra');
716
const path = require('path');
817

9-
function createArgv (argv) {
18+
function createArgv(argv) {
1019
return require('yargs/yargs')(argv).argv;
1120
}
1221

13-
function createTestDirectory () {
22+
function createTestDirectory() {
1423
const projectDir = testSetup.createTestAppDir();
1524
fs.writeFileSync(
1625
path.join(projectDir, 'package.json'),
@@ -58,7 +67,7 @@ describe('parse-runtime', () => {
5867

5968
expect(config.environment).to.equal('dev');
6069
expect(config.useDevServer).to.be.true;
61-
expect(config.devServerUrl).to.equal('http://localhost:8080/')
70+
expect(config.devServerUrl).to.equal('http://localhost:8080/');
6271
});
6372

6473
it('dev-server command with options', () => {
@@ -67,15 +76,15 @@ describe('parse-runtime', () => {
6776

6877
expect(config.environment).to.equal('dev');
6978
expect(config.useDevServer).to.be.true;
70-
expect(config.devServerUrl).to.equal('http://foohost.l:9999/')
79+
expect(config.devServerUrl).to.equal('http://foohost.l:9999/');
7180
});
7281

7382
it('dev-server command https', () => {
7483
const testDir = createTestDirectory();
7584
const config = parseArgv(createArgv(['dev-server', '--https', '--host', 'foohost.l', '--port', '9999']), testDir);
7685

7786
expect(config.useDevServer).to.be.true;
78-
expect(config.devServerUrl).to.equal('https://foohost.l:9999/')
87+
expect(config.devServerUrl).to.equal('https://foohost.l:9999/');
7988
});
8089

8190
it('--context is parsed correctly', () => {

0 commit comments

Comments
 (0)