Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-11-04 06:53:17 +0300
committerAlfredo Sumaran <alfredo@gitlab.com>2016-11-04 06:53:17 +0300
commit3a8a7c1251cef4098ffbc54718ba21736c5e2800 (patch)
treef582d8ecfde3250ae4b34da26079c1a8a1c81a23
parent630c40b9a2b14c96254a21bea23835e28ae6140a (diff)
parent99a000da34d5f4b07548602d6503eb60e00344de (diff)
Merge branch 'fix-invalid-filename-eslint' into 'master'
eslint: Fix invalid filename validation Attempt to fix the following error which is appearing in every new MR since `eslint-plugin-filenames` was introduced. ``` /builds/gitlab-org/gitlab-ce/app/assets/javascripts/gl_field_error.js.es6 2:1 error Filename 'gl_field_error.js.es6' does not match the naming convention filenames/match-regex ``` This was happening because our ES6 files have the following structure `gl_hello_world.js.es6`. So `eslint-plugin-filenames` was considering as base name `gl_hello_world.js` which didn't pass the previous regex `^[a-z_]+$` This new regex allows the following filenames to pass as valid: - `gl_hello_world.js.es6` which base name translates to `gl_hello_world.js` - `gl_foo_bar.js` which base name translates to `gl_foo_bar` - `d3.js` which base name translates to `d3` (especial case, maybe we should move this to the vendor dir and make the regex more specific) See merge request !7281
-rw-r--r--.eslintrc2
-rw-r--r--app/assets/javascripts/application.js1
-rw-r--r--changelogs/unreleased/fix-invalid-filename-eslint.yml4
-rw-r--r--spec/javascripts/merge_request_widget_spec.js2
-rw-r--r--vendor/assets/javascripts/jquery.timeago.js (renamed from app/assets/javascripts/lib/utils/jquery.timeago.js)0
5 files changed, 7 insertions, 2 deletions
diff --git a/.eslintrc b/.eslintrc
index b58007d90a9..fd26215b843 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -4,7 +4,7 @@
"filenames"
],
"rules": {
- "filenames/match-regex": [2, "^[a-z_]+$"]
+ "filenames/match-regex": [2, "^[a-z0-9_]+(.js)?$"]
},
"globals": {
"$": false,
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 7dd9adac736..d56eb4c0199 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -13,6 +13,7 @@
/*= require jquery-ui/sortable */
/*= require jquery_ujs */
/*= require jquery.endless-scroll */
+/*= require jquery.timeago */
/*= require jquery.highlight */
/*= require jquery.waitforimages */
/*= require jquery.atwho */
diff --git a/changelogs/unreleased/fix-invalid-filename-eslint.yml b/changelogs/unreleased/fix-invalid-filename-eslint.yml
new file mode 100644
index 00000000000..eea21149c90
--- /dev/null
+++ b/changelogs/unreleased/fix-invalid-filename-eslint.yml
@@ -0,0 +1,4 @@
+---
+title: Fix invalid filename validation on eslint
+merge_request: 7281
+author:
diff --git a/spec/javascripts/merge_request_widget_spec.js b/spec/javascripts/merge_request_widget_spec.js
index 1e2072f370a..49dfeab61d8 100644
--- a/spec/javascripts/merge_request_widget_spec.js
+++ b/spec/javascripts/merge_request_widget_spec.js
@@ -1,6 +1,6 @@
/* eslint-disable */
/*= require merge_request_widget */
-/*= require lib/utils/jquery.timeago.js */
+/*= require jquery.timeago.js */
(function() {
describe('MergeRequestWidget', function() {
diff --git a/app/assets/javascripts/lib/utils/jquery.timeago.js b/vendor/assets/javascripts/jquery.timeago.js
index de76cdd2ea7..de76cdd2ea7 100644
--- a/app/assets/javascripts/lib/utils/jquery.timeago.js
+++ b/vendor/assets/javascripts/jquery.timeago.js