Skip to content

Commit 60d6ca9

Browse files
authored
[qa] Switched to prettier for CSS/JS formatting
1 parent 37fd040 commit 60d6ca9

File tree

7 files changed

+52
-109
lines changed

7 files changed

+52
-109
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
sudo apt-get -qq -y install gettext
5353
pip install -U pip wheel
5454
pip install -U -r requirements-test.txt
55-
sudo npm install -g jshint
55+
sudo npm install -g prettier
5656
pip install -e .[rest]
5757
pip install -U ${{ matrix.django-version }}
5858

.jshint

Lines changed: 0 additions & 49 deletions
This file was deleted.

.stylelintrc.json

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
input.readonly{
1+
input.readonly {
22
border: 1px solid rgba(0, 0, 0, 0.05) !important;
3-
background-color: rgba(0, 0, 0, 0.070);
3+
background-color: rgba(0, 0, 0, 0.07);
44
}
Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
(function ($) {
2-
'use strict';
2+
"use strict";
33
$(document).ready(function () {
4-
var superuser = $('#id_is_superuser'),
5-
staff = $('#id_is_staff'),
6-
orgs = $('#openwisp_users_organizationuser-group');
4+
var superuser = $("#id_is_superuser"),
5+
staff = $("#id_is_staff"),
6+
orgs = $("#openwisp_users_organizationuser-group");
77
superuser.change(function (e) {
88
// when enabling superuser
9-
if (superuser.is(':checked')) {
9+
if (superuser.is(":checked")) {
1010
// hide organization details because they're not needed
1111
orgs.hide();
1212
// reset all org fields
13-
orgs.find('.field-is_admin input').prop('checked', false);
14-
orgs.find('.field-organization select').val('');
13+
orgs.find(".field-is_admin input").prop("checked", false);
14+
orgs.find(".field-organization select").val("");
1515
// enable staff too
16-
if (!staff.is(':checked')) {
17-
staff.trigger('click');
16+
if (!staff.is(":checked")) {
17+
staff.trigger("click");
1818
}
19-
// when disabling superuser, show organizations
19+
// when disabling superuser, show organizations
2020
} else {
2121
orgs.show();
2222
}
2323
});
2424
staff.change(function (e) {
2525
// enable also is_admin in org unless superuser
26-
if (!superuser.is(':checked')) {
27-
orgs.find('.field-is_admin input').prop('checked', staff.is(':checked'));
26+
if (!superuser.is(":checked")) {
27+
orgs
28+
.find(".field-is_admin input")
29+
.prop("checked", staff.is(":checked"));
2830
}
2931
});
30-
staff.trigger('change');
31-
superuser.trigger('change');
32+
staff.trigger("change");
33+
superuser.trigger("change");
3234
});
33-
}(django.jQuery));
35+
})(django.jQuery);
Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(function ($) {
2-
'use strict';
2+
"use strict";
33
$(document).ready(function () {
44
// The select2 library requires data in a specific format
55
// https://select2.org/data-sources/formats.
@@ -9,51 +9,56 @@
99
// Django expects an empty string (for None) or a UUID string.
1010
// Hence, we need to update the value of selected option before
1111
// submission of form.
12-
var formElement = $('select#id_organization');
13-
while (formElement.prop('tagName') !== 'FORM'){
12+
var formElement = $("select#id_organization");
13+
while (formElement.prop("tagName") !== "FORM") {
1414
formElement = formElement.parent();
1515
}
16-
formElement.submit(function(){
17-
var target = $('select#id_organization option:selected');
18-
if (target.val() === 'null') {
19-
target.val('');
16+
formElement.submit(function () {
17+
var target = $("select#id_organization option:selected");
18+
if (target.val() === "null") {
19+
target.val("");
2020
}
2121
});
2222

23-
if (!$('select#id_organization').val()) {
24-
var orgField = $('#id_organization'),
25-
pathName = window.location.pathname.split('/');
23+
if (!$("select#id_organization").val()) {
24+
var orgField = $("#id_organization"),
25+
pathName = window.location.pathname.split("/");
2626
// If the field is rendered empty on a change form, then the
2727
// the object is shared systemwide (no organization).
28-
if (pathName[pathName.length - 2] == 'change') {
29-
orgField.val('null');
30-
orgField.trigger('change');
28+
if (pathName[pathName.length - 2] == "change") {
29+
orgField.val("null");
30+
orgField.trigger("change");
3131
return;
3232
}
3333

3434
// If only one organization option is available, then select that
3535
// organization automatically
3636
$.ajax({
37-
url: orgField.data('ajax--url'),
37+
url: orgField.data("ajax--url"),
3838
data: {
39-
app_label: orgField.data('app-label'),
40-
model_name: orgField.data('model-name'),
41-
field_name: orgField.data('field-name')
39+
app_label: orgField.data("app-label"),
40+
model_name: orgField.data("model-name"),
41+
field_name: orgField.data("field-name"),
4242
},
4343
success: function (data) {
4444
if (data.results.length === 1) {
45-
var option = new Option(data.results[0].text, data.results[0].id, true, true);
46-
orgField.append(option).trigger('change');
45+
var option = new Option(
46+
data.results[0].text,
47+
data.results[0].id,
48+
true,
49+
true,
50+
);
51+
orgField.append(option).trigger("change");
4752
// manually trigger the `select2:select` event
4853
orgField.trigger({
49-
type: 'select2:select',
54+
type: "select2:select",
5055
params: {
51-
data: data.results[0]
52-
}
56+
data: data.results[0],
57+
},
5358
});
5459
}
55-
}
60+
},
5661
});
5762
}
5863
});
59-
}(django.jQuery));
64+
})(django.jQuery);

run-qa-checks

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/bin/bash
22
set -e
33

4-
jshint ./openwisp_users/static/openwisp-users/js/*.js
5-
64
echo ''
75
echo 'Compiling translations'
86
cd openwisp_users
@@ -12,7 +10,9 @@ cd ..
1210
openwisp-qa-check \
1311
--migrations-to-ignore 2 \
1412
--migration-path './openwisp_users/migrations' \
15-
--migration-module openwisp_users
13+
--migration-module openwisp_users \
14+
--csslinter \
15+
--jslinter
1616

1717
echo ''
1818
echo 'Running checks for testapp'

0 commit comments

Comments
 (0)