mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	rework eslint config (#11615)
* rework eslint config - use explicit config that only enables rules - upgrade eslint to 7.1.0 - add new plugins with selected rules enabled - fix discovered issues, remove global wipPrefixes * remove if * undo template change * add disabled rules as well for easier config updating * add missing disabled rule * update eslint and plugins * fix new violation * remove deprecated rules Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
		@@ -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;
 | 
			
		||||
  });
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ const languagesByExt = {};
 | 
			
		||||
function getEditorconfig(input) {
 | 
			
		||||
  try {
 | 
			
		||||
    return JSON.parse(input.dataset.editorconfig);
 | 
			
		||||
  } catch (_err) {
 | 
			
		||||
  } catch {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import {highlightBlock} from 'highlight.js';
 | 
			
		||||
import {createWindow} from 'domino';
 | 
			
		||||
 | 
			
		||||
self.onmessage = function ({data}) {
 | 
			
		||||
self.addEventListener('message', ({data}) => {
 | 
			
		||||
  const window = createWindow();
 | 
			
		||||
  self.document = window.document;
 | 
			
		||||
 | 
			
		||||
@@ -9,4 +9,4 @@ self.onmessage = function ({data}) {
 | 
			
		||||
  document.body.innerHTML = html;
 | 
			
		||||
  highlightBlock(document.body.firstChild);
 | 
			
		||||
  self.postMessage({index, html: document.body.innerHTML});
 | 
			
		||||
};
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,3 @@
 | 
			
		||||
/* globals wipPrefixes */
 | 
			
		||||
/* exported timeAddManual, toggleStopwatch, cancelStopwatch */
 | 
			
		||||
/* exported toggleDeadlineForm, setDeadline, updateDeadline, deleteDependencyModal, cancelCodeComment, onOAuthLoginClick */
 | 
			
		||||
 | 
			
		||||
@@ -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;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
@@ -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;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
@@ -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';
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user