Skip to content

Commit

Permalink
Specialize linting in test/integration and docs/ directories (#5165)
Browse files Browse the repository at this point in the history
* Lint test/integration directory for node v4 support

Closes #5164

* Lint docs/ directory for ES5-only
  • Loading branch information
anandthakker authored Aug 18, 2017
1 parent 9781e79 commit 3fd7c5d
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 9 deletions.
13 changes: 13 additions & 0 deletions docs/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"parser": "espree",
"parserOptions": {
"ecmaVersion": 5
},
"env": {
"es6": false,
"browser": true
},
"globals": {
"Uint8Array": true
}
}
10 changes: 5 additions & 5 deletions docs/_posts/examples/3400-01-31-add-image-generated.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
style: 'mapbox://styles/mapbox/streets-v9'
});

map.on('load', () => {
map.on('load', function () {

const width = 64; // The image will be 64 pixels square
const bytesPerPixel = 4; // Each pixel is represented by 4 bytes: red, green, blue, and alpha.
const image = new Uint8Array(width * width * bytesPerPixel);
var width = 64; // The image will be 64 pixels square
var bytesPerPixel = 4; // Each pixel is represented by 4 bytes: red, green, blue, and alpha.
var image = new Uint8Array(width * width * bytesPerPixel);

for (var x = 0; x < width; x++) {
for (var y = 0; y < width; y++) {
const offset = (y * width + x) * bytesPerPixel;
var offset = (y * width + x) * bytesPerPixel;
image[offset + 0] = y / width * 255; // red
image[offset + 1] = x / width * 255; // green
image[offset + 2] = 128; // blue
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"eslint-config-mourner": "^2.0.0",
"eslint-plugin-flowtype": "^2.34.0",
"eslint-plugin-html": "^3.0.0",
"eslint-plugin-node": "^5.1.1",
"flow-bin": "^0.52.0",
"flow-coverage-report": "^0.3.0",
"flow-remove-types": "^1.0.4",
Expand Down
10 changes: 10 additions & 0 deletions test/integration/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"plugins": [
"node"
],
"rules": {
"node/no-unsupported-features": ["error", {
"version": 4
}]
}
}
6 changes: 3 additions & 3 deletions test/integration/lib/harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,18 @@ module.exports = function (directory, implementation, options, run) {
const itemTemplate = template(fs.readFileSync(path.join(directory, 'result_item.html.tmpl'), 'utf8'));

const failed = results.filter(r => /failed/.test(r.status));
const [pre, post] = resultsTemplate({ failed })
const resultsShell = resultsTemplate({ failed })
.split('<!-- results go here -->');

const p = path.join(directory, 'index.html');
const out = fs.createWriteStream(p);

const q = queue(1);
q.defer(write, out, pre);
q.defer(write, out, resultsShell[0]);
for (const r of results) {
q.defer(write, out, itemTemplate({ r, hasFailedTests: failed.length > 0 }));
}
q.defer(write, out, post);
q.defer(write, out, resultsShell[1]);
q.await(() => {
out.end();
out.on('close', () => {
Expand Down
17 changes: 16 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2352,6 +2352,15 @@ eslint-plugin-html@^3.0.0:
dependencies:
htmlparser2 "^3.8.2"

eslint-plugin-node@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-node/-/eslint-plugin-node-5.1.1.tgz#a7ed956e780c22aef6afd1116005acd82f26eac6"
dependencies:
ignore "^3.3.3"
minimatch "^3.0.4"
resolve "^1.3.3"
semver "5.3.0"

eslint-scope@^3.7.1:
version "3.7.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
Expand Down Expand Up @@ -5619,6 +5628,12 @@ resolve@^1.1.3, resolve@^1.1.4, resolve@^1.1.5, resolve@^1.1.6:
dependencies:
path-parse "^1.0.5"

resolve@^1.3.3:
version "1.4.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86"
dependencies:
path-parse "^1.0.5"

restore-cursor@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
Expand Down Expand Up @@ -5685,7 +5700,7 @@ select@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d"

"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.3.0, semver@~5.3.0:
"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@5.3.0, semver@^5.3.0, semver@~5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"

Expand Down

0 comments on commit 3fd7c5d

Please sign in to comment.