Skip to content

rework eslint config #11615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
347 changes: 338 additions & 9 deletions .eslintrc

Large diffs are not rendered by default.

485 changes: 361 additions & 124 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@
"worker-loader": "2.0.0"
},
"devDependencies": {
"eslint": "6.8.0",
"eslint-config-airbnb-base": "14.1.0",
"eslint-plugin-import": "2.20.2",
"eslint": "7.2.0",
"eslint-plugin-import": "2.21.1",
"eslint-plugin-sonarjs": "0.5.0",
"eslint-plugin-unicorn": "20.1.0",
"stylelint": "13.3.3",
"stylelint-config-standard": "20.0.0",
"updates": "10.2.11"
Expand Down
7 changes: 2 additions & 5 deletions templates/repo/issue/new_form.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="field">
<input name="title" id="issue_title" placeholder="{{.i18n.Tr "repo.milestones.title"}}" value="{{.title}}" tabindex="3" autofocus required maxlength="255">
{{if .PageIsComparePull}}
<div class="title_wip_desc">{{.i18n.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}}</div>
<div class="title_wip_desc" data-wip-prefixes="{{Json .PullRequestWorkInProgressPrefixes}}">{{.i18n.Tr "repo.pulls.title_wip_desc" (index .PullRequestWorkInProgressPrefixes 0| Escape) | Safe}}</div>
{{end}}
</div>
{{template "repo/issue/comment_tab" .}}
Expand Down Expand Up @@ -59,7 +59,7 @@
<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check" 16}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}}
{{if .Description }}<br><small class="desc">{{.Description | RenderEmoji}}</small>{{end}}</a>
{{end}}

<div class="ui divider"></div>
{{range .OrgLabels}}
<a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}"><span class="octicon-check {{if not .IsChecked}}invisible{{end}}">{{svg "octicon-check" 16}}</span><span class="label color" style="background-color: {{.Color}}"></span> {{.Name | RenderEmoji}}
Expand Down Expand Up @@ -176,7 +176,4 @@
</div>
</div>
</form>
{{if .PageIsComparePull}}
<script>window.wipPrefixes = {{.PullRequestWorkInProgressPrefixes}}</script>
{{end}}

17 changes: 8 additions & 9 deletions web_src/js/features/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ export default async function initClipboard() {
const clipboard = new ClipboardJS(els);
clipboard.on('success', (e) => {
e.clearSelection();

$(`#${e.trigger.getAttribute('id')}`).popup('destroy');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-success'));
$(`#${e.trigger.getAttribute('id')}`).popup('show');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'));
$(e.trigger).popup('destroy');
e.trigger.dataset.content = e.trigger.dataset.success;
$(e.trigger).popup('show');
e.trigger.dataset.content = e.trigger.dataset.original;
});

clipboard.on('error', (e) => {
$(`#${e.trigger.getAttribute('id')}`).popup('destroy');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-error'));
$(`#${e.trigger.getAttribute('id')}`).popup('show');
e.trigger.setAttribute('data-content', e.trigger.getAttribute('data-original'));
$(e.trigger).popup('destroy');
e.trigger.dataset.content = e.trigger.dataset.error;
$(e.trigger).popup('show');
e.trigger.dataset.content = e.trigger.dataset.original;
});
}
2 changes: 1 addition & 1 deletion web_src/js/features/codeeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const languagesByExt = {};
function getEditorconfig(input) {
try {
return JSON.parse(input.dataset.editorconfig);
} catch (_err) {
} catch {
return null;
}
}
Expand Down
4 changes: 2 additions & 2 deletions web_src/js/features/highlight.worker.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {highlightBlock} from 'highlight.js';
import {createWindow} from 'domino';

self.onmessage = function ({data}) {
self.addEventListener('message', ({data}) => {
const window = createWindow();
self.document = window.document;

const {index, html} = data;
document.body.innerHTML = html;
highlightBlock(document.body.firstChild);
self.postMessage({index, html: document.body.innerHTML});
};
});
19 changes: 9 additions & 10 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* globals wipPrefixes */
/* exported timeAddManual, toggleStopwatch, cancelStopwatch */
/* exported toggleDeadlineForm, setDeadline, updateDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */

Expand Down Expand Up @@ -2178,8 +2177,9 @@ function initWipTitle() {
$issueTitle.focus();
const value = $issueTitle.val().trim().toUpperCase();

for (const i in wipPrefixes) {
if (value.startsWith(wipPrefixes[i].toUpperCase())) {
const wipPrefixes = $('.title_wip_desc').data('wip-prefixes');
for (const prefix of wipPrefixes) {
if (value.startsWith(prefix.toUpperCase())) {
return;
}
}
Expand Down Expand Up @@ -2472,10 +2472,9 @@ $(document).ready(async () => {
'div.repository.settings.collaboration': initRepositoryCollaboration
};

let selector;
for (selector in routes) {
for (const [selector, fn] of Object.entries(routes)) {
if ($(selector).length > 0) {
routes[selector]();
fn();
break;
}
}
Expand Down Expand Up @@ -2972,13 +2971,13 @@ function initVueComponents() {
repoClass(repo) {
if (repo.fork) {
return 'octicon-repo-forked';
} if (repo.mirror) {
} else if (repo.mirror) {
return 'octicon-repo-clone';
} if (repo.template) {
} else if (repo.template) {
return `octicon-repo-template${repo.private ? '-private' : ''}`;
} if (repo.private) {
} else if (repo.private) {
return 'octicon-lock';
} if (repo.internal) {
} else if (repo.internal) {
return 'octicon-internal-repo';
}
return 'octicon-repo';
Expand Down