Skip to content

Commit a65141c

Browse files
eslint: update and package
1 parent bc632f7 commit a65141c

File tree

8 files changed

+1308
-93
lines changed

8 files changed

+1308
-93
lines changed

.eslintrc.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Copyright (C) NIWA & British Crown (Met Office) & Contributors.
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
module.exports = {
19+
root: true,
20+
env: {
21+
browser: true
22+
},
23+
extends: [
24+
'standard',
25+
'eslint:recommended'
26+
],
27+
rules: {
28+
'operator-linebreak': ['error', 'before']
29+
},
30+
globals: {
31+
'$': 'readonly'
32+
}
33+
}

.eslintrc.json

-11
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ doc
77
venv
88
metomi_rose.egg-info
99
dist
10+
node_modules
1011

1112
# coverage
1213
.coverage

package.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "metomi-rose",
3+
"private": true,
4+
"scripts": {
5+
"lint": "eslint -c .eslintrc.js sphinx/"
6+
},
7+
"dependencies": {
8+
"eslint-plugin-import": "^2.22.1",
9+
"eslint-plugin-node": "^11.1.0",
10+
"eslint-plugin-promise": "^4.2.1",
11+
"eslint-plugin-standard": "^5.0.0"
12+
},
13+
"devDependencies": {
14+
"eslint": "^7.14.0",
15+
"eslint-config-standard": "^14.1.1"
16+
},
17+
"bugs": {
18+
"url": "https://github.com/metomi/rose/issues"
19+
}
20+
}

sphinx/_static/js/versioning.js

+54-47
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,59 @@
11
/* global root_dir current_builder current_page_name current_version */
2+
/* eslint camelcase: "off" */ // global vars not in camel case
23

3-
$(document).ready(function() {
4-
$.ajax({
5-
'async': false,
6-
'type': 'GET',
7-
'url': root_dir + 'versions.json',
8-
dataType: 'json',
9-
success: function (versions) {
10-
// the DOM element to append version and format selectors to
11-
var ele = $('#version-selector');
4+
$(document).ready(function () {
5+
$.ajax({
6+
async: false,
7+
type: 'GET',
8+
url: root_dir + 'versions.json',
9+
dataType: 'json',
10+
success: function (versions) {
11+
// the DOM element to append version and format selectors to
12+
var ele = $('#version-selector')
1213

13-
// construct version selector
14-
var ver = ele.append($('<dl />'));
15-
$(ver).append($('<dt />').append('Versions'));
16-
for (let version of Object.keys(versions).sort().reverse()) {
17-
$(ver).append($('<dd />')
18-
.append($('<a />')
19-
.attr({'href': root_dir + version + '/' +
20-
current_builder + '/' +
21-
current_page_name + '.html'})
22-
.append(version)
23-
)
24-
);
25-
}
14+
// construct version selector
15+
var ver = ele.append($('<dl />'))
16+
$(ver).append($('<dt />').append('Versions'))
17+
for (const version of Object.keys(versions).sort().reverse()) {
18+
$(ver).append($('<dd />')
19+
.append($('<a />')
20+
.attr({
21+
href: root_dir
22+
+ version + '/'
23+
+ current_builder
24+
+ '/'
25+
+ current_page_name + '.html'
26+
})
27+
.append(version)
28+
)
29+
)
30+
}
2631

27-
// construct format selector
28-
var bui = ele.append($('<dl />'));
29-
$(bui).append($('<dt />').append('Formats'));
30-
var href;
31-
for (let builder_for_version of versions[current_version].sort()) {
32-
href = root_dir + current_version + '/' + builder_for_version +
33-
'/';
34-
if (['html', 'slides'].indexOf(builder_for_version) >= 0) {
35-
// format has compatible document structure
36-
href += current_page_name + '.html';
37-
} else {
38-
// structure different, link to the index.html page
39-
href += 'index.html';
40-
}
41-
42-
43-
$(bui).append($('<dd />')
44-
.append($('<a />')
45-
.attr({'href': href})
46-
.append(builder_for_version)
47-
)
48-
);
49-
}
32+
// construct format selector
33+
var bui = ele.append($('<dl />'))
34+
$(bui).append($('<dt />').append('Formats'))
35+
var href
36+
for (const builderForVersion of versions[current_version].sort()) {
37+
href = root_dir
38+
+ current_version
39+
+ '/'
40+
+ builderForVersion
41+
+ '/'
42+
if (['html', 'slides'].indexOf(builderForVersion) >= 0) {
43+
// format has compatible document structure
44+
href += current_page_name + '.html'
45+
} else {
46+
// structure different, link to the index.html page
47+
href += 'index.html'
5048
}
51-
});
52-
});
49+
50+
$(bui).append($('<dd />')
51+
.append($('<a />')
52+
.attr({ href: href })
53+
.append(builderForVersion)
54+
)
55+
)
56+
}
57+
}
58+
})
59+
})

t/syntax/00-eslint.t

-34
This file was deleted.

t/syntax/test_header

-1
This file was deleted.

0 commit comments

Comments
 (0)