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
This commit is contained in:
Alfredo Sumaran 2016-11-04 03:53:17 +00:00
commit 3a8a7c1251
5 changed files with 7 additions and 2 deletions

View File

@ -4,7 +4,7 @@
"filenames"
],
"rules": {
"filenames/match-regex": [2, "^[a-z_]+$"]
"filenames/match-regex": [2, "^[a-z0-9_]+(.js)?$"]
},
"globals": {
"$": false,

View File

@ -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 */

View File

@ -0,0 +1,4 @@
---
title: Fix invalid filename validation on eslint
merge_request: 7281
author:

View File

@ -1,6 +1,6 @@
/* eslint-disable */
/*= require merge_request_widget */
/*= require lib/utils/jquery.timeago.js */
/*= require jquery.timeago.js */
(function() {
describe('MergeRequestWidget', function() {