Commit 40d309cc authored by Mike Greiling's avatar Mike Greiling

Merge branch '59733-autofix-i18n-offences-in-js-files-using-eslint' into 'master'

"Add ESLint  i18n plugin"

Closes #62359

See merge request gitlab-org/gitlab-ce!26789
parents ea9fcebf 3d8163dc
......@@ -8,11 +8,13 @@ globals:
plugins:
- import
- html
- "@gitlab/i18n"
settings:
import/resolver:
webpack:
config: './config/webpack.config.js'
rules:
"@gitlab/i18n/no-non-i18n-strings": error
import/no-commonjs: error
no-underscore-dangle:
- error
......@@ -31,3 +33,11 @@ rules:
vue/no-use-v-if-with-v-for: off
vue/no-v-html: off
vue/use-v-on-exact: off
overrides:
files:
# Vue is temporarily being disabled until the autofix errors are resolved
# Follow up issue https://gitlab.com/gitlab-org/gitlab-ce/issues/57969
- '*.vue'
- '**/spec/**/*'
rules:
"@gitlab/i18n/no-non-i18n-strings": off
/* eslint-disable class-methods-use-this */
/* eslint-disable class-methods-use-this, @gitlab/i18n/no-non-i18n-strings */
import $ from 'jquery';
import _ from 'underscore';
......
const notImplemented = () => {
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
throw new Error('Not implemented!');
};
......
import * as mutationTypes from './mutation_types';
const notImplemented = () => {
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
throw new Error('Not implemented!');
};
......
......@@ -29,4 +29,5 @@ export const updateDraft = (autosaveKey, text) => {
};
export const getDiscussionReplyKey = (noteableType, discussionId) =>
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
['Note', capitalizeFirstCharacter(noteableType), discussionId, 'Reply'].join('/');
......@@ -12,6 +12,7 @@ function notificationGranted(message, opts, onclick) {
}
function notifyPermissions() {
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
if ('Notification' in window) {
return Notification.requestPermission();
}
......@@ -24,6 +25,7 @@ function notifyMe(message, body, icon, onclick) {
icon: icon,
};
// Let's check if the browser supports notifications
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
if (!('Notification' in window)) {
// do nothing
} else if (Notification.permission === 'granted') {
......
/* eslint-disable func-names, no-var, one-var, consistent-return, no-return-assign, prefer-arrow-callback, prefer-template, no-shadow, no-else-return */
/* eslint-disable func-names, no-var, one-var, consistent-return, no-return-assign, prefer-arrow-callback, prefer-template, no-shadow, no-else-return, @gitlab/i18n/no-non-i18n-strings */
import $ from 'jquery';
import RefSelectDropdown from './ref_select_dropdown';
......
......@@ -124,11 +124,14 @@ export const ContributorsGraph = (function() {
};
ContributorsGraph.prototype.draw_x_axis = function() {
return this.svg
.append('g')
.attr('class', 'x axis')
.attr('transform', 'translate(0, ' + this.height + ')')
.call(this.x_axis);
return (
this.svg
.append('g')
.attr('class', 'x axis')
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
.attr('transform', 'translate(0, ' + this.height + ')')
.call(this.x_axis)
);
};
ContributorsGraph.prototype.draw_y_axis = function() {
......@@ -205,6 +208,7 @@ export const ContributorsMasterGraph = (function(superClass) {
.attr('height', this.height + this.MARGIN.top + this.MARGIN.bottom)
.attr('class', 'tint-box')
.append('g')
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
.attr('transform', 'translate(' + this.MARGIN.left + ',' + this.MARGIN.top + ')');
return this.svg;
};
......@@ -354,6 +358,7 @@ export const ContributorsAuthorGraph = (function(superClass) {
.attr('height', this.height + this.MARGIN.top + this.MARGIN.bottom)
.attr('class', 'spark')
.append('g')
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
.attr('transform', 'translate(' + this.MARGIN.left + ',' + this.MARGIN.top + ')');
return this.svg;
};
......
......@@ -18,6 +18,7 @@ const defaultClient = createDefaultClient(
cacheConfig: {
fragmentMatcher,
dataIdFromObject: obj => {
/* eslint-disable @gitlab/i18n/no-non-i18n-strings */
// eslint-disable-next-line no-underscore-dangle
switch (obj.__typename) {
// We need to create a dynamic ID for each entry
......@@ -33,6 +34,7 @@ const defaultClient = createDefaultClient(
// eslint-disable-next-line no-underscore-dangle
return obj.id || obj._id;
}
/* eslint-enable @gitlab/i18n/no-non-i18n-strings */
},
},
},
......
......@@ -5,5 +5,6 @@ export const setTitle = (pathMatch, ref, project) => {
const path = pathMatch.replace(/^\//, '');
const isEmpty = path === '';
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
document.title = `${isEmpty ? 'Files' : path} · ${ref} · ${project}`;
};
......@@ -447,9 +447,11 @@ export class SearchAutocomplete {
onClick(item, $el, e) {
if (window.location.pathname.indexOf(item.url) !== -1) {
if (!e.metaKey) e.preventDefault();
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
if (item.category === 'Projects') {
this.projectInputEl.val(item.id);
}
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
if (item.category === 'Groups') {
this.groupInputEl.val(item.id);
}
......
......@@ -427,6 +427,7 @@ function UsersSelect(currentUser, els, options = {}) {
const isActive = $el.hasClass('is-active');
const previouslySelected = $dropdown
.closest('.selectbox')
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
.find("input[name='" + $dropdown.data('fieldName') + "'][value!=0]");
// Enables support for limiting the number of users selected
......
......@@ -693,6 +693,13 @@
eslint-plugin-promise "^4.1.1"
eslint-plugin-vue "^5.0.0"
"@gitlab/eslint-plugin-i18n@^1.0.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@gitlab/eslint-plugin-i18n/-/eslint-plugin-i18n-1.1.0.tgz#e494d599e644ce3a094ea85f87dbbda41a924c5e"
integrity sha512-Cwm7sLtQnUDqvxE9Ez8UMslyosPCpMVLxBnFb+2n6QcBZmXRao4aNSVRkmlsDZYgYegWhOGn3Qq3MLy4BSqauQ==
dependencies:
requireindex "~1.1.0"
"@gitlab/svgs@^1.63.0":
version "1.63.0"
resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.63.0.tgz#9dd544026d203e4ce6efed72b05db68f710c4d49"
......@@ -9439,6 +9446,11 @@ require-uncached@^1.0.3:
caller-path "^0.1.0"
resolve-from "^1.0.0"
requireindex@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/requireindex/-/requireindex-1.1.0.tgz#e5404b81557ef75db6e49c5a72004893fe03e162"
integrity sha1-5UBLgVV+91225JxacgBIk/4D4WI=
requires-port@1.x.x, requires-port@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment