Use explicit jQuery import, remove unused eslint globals (#18435)

- Don't rely on globals (window.$) for jQuery import
- Remove eslint globals no longer in use
This commit is contained in:
2022-01-28 13:00:11 -08:00
committed by GitHub
parent 7b04c97b7b
commit 19b017f398
51 changed files with 76 additions and 18 deletions
-4
View File
@@ -23,9 +23,6 @@ env:
globals:
__webpack_public_path__: true
CodeMirror: false
Dropzone: false
SimpleMDE: false
settings:
html/html-extensions: [".tmpl"]
@@ -34,7 +31,6 @@ overrides:
- files: ["web_src/**/*.js", "web_src/**/*.vue", "templates/**/*.tmpl"]
env:
browser: true
jquery: true
node: false
- files: ["templates/**/*.tmpl"]
rules:
+1
View File
@@ -24,6 +24,7 @@
</template>
<script>
import $ from 'jquery';
import {SvgIcon} from '../svg.js';
const {appSubUrl, i18n} = window.config;
@@ -1,4 +1,5 @@
import Vue from 'vue';
import $ from 'jquery';
import {initVueSvg, vueDelimiters} from './VueComponentLoader.js';
const {appSubUrl, assetUrlPrefix, pageData} = window.config;
@@ -1,4 +1,5 @@
import Vue from 'vue';
import $ from 'jquery';
import {vueDelimiters} from './VueComponentLoader.js';
export function initRepoBranchTagDropdown(selector) {
+2
View File
@@ -1,3 +1,5 @@
import $ from 'jquery';
const {csrfToken} = window.config;
export function initAdminCommon() {
+2
View File
@@ -1,3 +1,5 @@
import $ from 'jquery';
export function initAdminEmails() {
function linkEmailAction(e) {
const $this = $(this);
+2
View File
@@ -1,3 +1,5 @@
import $ from 'jquery';
export function initAdminUserListSearchForm() {
const searchForm = window.config.pageData.adminUserListSearchForm;
if (!searchForm) return;
+2
View File
@@ -1,3 +1,5 @@
import $ from 'jquery';
const {copy_success, copy_error} = window.config.i18n;
function onSuccess(btn) {
+2 -2
View File
@@ -1,9 +1,9 @@
import $ from 'jquery';
import 'jquery.are-you-sure';
import {mqBinarySearch} from '../utils.js';
import createDropzone from './dropzone.js';
import {initCompColorPicker} from './comp/ColorPicker.js';
import 'jquery.are-you-sure';
const {csrfToken} = window.config;
export function initGlobalFormDirtyLeaveConfirm() {
+1
View File
@@ -1,3 +1,4 @@
import $ from 'jquery';
import {updateIssuesMeta} from './repo-issue.js';
export function initCommonIssue() {
@@ -1,3 +1,4 @@
import $ from 'jquery';
import {initCompLabelEdit} from './comp/LabelEdit.js';
export function initCommonOrganization() {
+1
View File
@@ -1,3 +1,4 @@
import $ from 'jquery';
import createColorPicker from '../colorpicker.js';
export function initCompColorPicker() {
+3 -2
View File
@@ -1,3 +1,4 @@
import $ from 'jquery';
import attachTribute from '../tribute.js';
const {appSubUrl} = window.config;
@@ -54,7 +55,7 @@ export async function importEasyMDE() {
* @returns {null|EasyMDE}
*/
export async function createCommentEasyMDE(textarea, easyMDEOptions = {}) {
if (textarea instanceof jQuery) {
if (textarea instanceof $) {
textarea = textarea[0];
}
if (!textarea) {
@@ -151,7 +152,7 @@ export function attachEasyMDEToElements(easyMDE) {
* @returns {null|EasyMDE}
*/
export function getAttachedEasyMDE(el) {
if (el instanceof jQuery) {
if (el instanceof $) {
el = el[0];
}
if (!el) {
+1
View File
@@ -1,3 +1,4 @@
import $ from 'jquery';
const {csrfToken} = window.config;
async function uploadFile(file, uploadUrl) {
+1
View File
@@ -1,3 +1,4 @@
import $ from 'jquery';
import {initCompColorPicker} from './ColorPicker.js';
export function initCompLabelEdit(selector) {
@@ -1,3 +1,4 @@
import $ from 'jquery';
import {initMarkupContent} from '../../markup/content.js';
const {csrfToken} = window.config;
@@ -1,3 +1,4 @@
import $ from 'jquery';
const {csrfToken} = window.config;
export function initCompReactionSelector(parent) {
@@ -1,3 +1,4 @@
import $ from 'jquery';
import {htmlEscape} from 'escape-goat';
const {appSubUrl} = window.config;
@@ -1,3 +1,4 @@
import $ from 'jquery';
const {csrfToken} = window.config;
export function initCompWebHookEditor() {
+1 -1
View File
@@ -1,5 +1,5 @@
import $ from 'jquery';
import Vue from 'vue';
import ContextPopup from '../components/ContextPopup.vue';
import {parseIssueHref} from '../utils.js';
-1
View File
@@ -1,5 +1,4 @@
import Vue from 'vue';
import ActivityHeatmap from '../components/ActivityHeatmap.vue';
export default function initHeatmap() {
+2
View File
@@ -1,3 +1,5 @@
import $ from 'jquery';
function getDefaultSvgBoundsIfUndefined(svgXml, src) {
const DefaultSize = 300;
const MaxSize = 99999;
+2
View File
@@ -1,3 +1,5 @@
import $ from 'jquery';
export function initInstall() {
if ($('.page-content.install').length === 0) {
return;
+2 -1
View File
@@ -1,5 +1,6 @@
const {appSubUrl, csrfToken, notificationSettings} = window.config;
import $ from 'jquery';
const {appSubUrl, csrfToken, notificationSettings} = window.config;
let notificationSequenceNumber = 0;
export function initNotificationsTable() {
+2
View File
@@ -1,3 +1,5 @@
import $ from 'jquery';
const {appSubUrl} = window.config;
export function initOrgTeamSettings() {
+2
View File
@@ -1,3 +1,5 @@
import $ from 'jquery';
export function initRepoBranchButton() {
$('.show-create-branch-modal.button').on('click', function () {
$('#create-branch-form')[0].action = $('#create-branch-form').data('base-action') + $(this).data('branch-from-urlcomponent');
+1
View File
@@ -1,3 +1,4 @@
import $ from 'jquery';
import {svg} from '../svg.js';
function changeHash(hash) {
+2
View File
@@ -1,3 +1,5 @@
import $ from 'jquery';
const {csrfToken} = window.config;
export function initRepoEllipsisButton() {
+2
View File
@@ -1,3 +1,5 @@
import $ from 'jquery';
const {csrfToken} = window.config;
function getArchive($target, url, first) {
+2
View File
@@ -1,6 +1,8 @@
import $ from 'jquery';
import {initCompReactionSelector} from './comp/ReactionSelector.js';
import {initRepoIssueContentHistory} from './repo-issue-content.js';
import {validateTextareaNonEmpty} from './comp/EasyMDE.js';
const {csrfToken} = window.config;
export function initRepoDiffReviewButton() {

Some files were not shown because too many files have changed in this diff Show More