Skip to content

Conversation

@zeripath
Copy link
Contributor

@zeripath zeripath commented Jul 3, 2020

For some reason our eslint configuration is not working correctly
and a bug has become apparent when trying to backport this to 1.12.

Related #12095

Signed-off-by: Andrew Thornton art27@cantab.net

For some reason our eslint configuration is not working correctly
and a bug has become apparent when trying to backport this to 1.12.

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added type/bug issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. backport/v1.12 labels Jul 3, 2020
@zeripath zeripath added this to the 1.13.0 milestone Jul 3, 2020
@silverwind
Copy link
Member

eslint is working but it's not as strict as before. Can adjust the rules offended here.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 3, 2020
@silverwind
Copy link
Member

silverwind commented Jul 3, 2020

Here's a config adjustment to get master closer to the 1.12 config. It also fixes previously encountered airbnb/javascript#1632 by allowing self in worker scripts.

diff --git a/.eslintrc b/.eslintrc
index 8e478f4a5..388120e51 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -30,8 +30,10 @@ globals:
 overrides:
   - files: ["web_src/**/*worker.js"]
     env:
       worker: true
+    rules:
+      no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, location, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, status, statusbar, stop, toolbar, top]

 rules:
   accessor-pairs: [2]
   array-bracket-newline: [0]
@@ -115,9 +117,9 @@ rules:
   import/no-webpack-loader-syntax: [2]
   import/order: [0]
   import/prefer-default-export: [0]
   import/unambiguous: [0]
-  indent: [2, 2, {ignoreComments: true, SwitchCase: 1}]
+  indent: [2, 2, {SwitchCase: 1}]
   init-declarations: [0]
   key-spacing: [2]
   keyword-spacing: [2]
   line-comment-position: [0]
@@ -164,9 +166,9 @@ rules:
   no-dupe-else-if: [2]
   no-dupe-keys: [2]
   no-duplicate-case: [2]
   no-duplicate-imports: [2]
-  no-else-return: [0]
+  no-else-return: [2, {allowElseIf: false}]
   no-empty-character-class: [2]
   no-empty-function: [0]
   no-empty-pattern: [2]
   no-empty: [2, {allowEmptyCatch: true}]
@@ -222,9 +224,9 @@ rules:
   no-prototype-builtins: [2]
   no-redeclare: [2]
   no-regex-spaces: [2]
   no-restricted-exports: [0]
-  no-restricted-globals: [0]
+  no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, location, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, self, status, statusbar, stop, toolbar, top]
   no-restricted-imports: [0]
   no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement]
   no-return-assign: [0]
   no-return-await: [0]
@@ -263,9 +265,9 @@ rules:
   no-useless-concat: [2]
   no-useless-constructor: [2]
   no-useless-escape: [2]
   no-useless-rename: [2]
-  no-useless-return: [0]
+  no-useless-return: [2]
   no-var: [2]
   no-void: [2]
   no-warning-comments: [0]
   no-whitespace-before-property: [2]

Copy link
Member

@techknowlogick techknowlogick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is a bugfix as notifications worked when I tested the original PR, but rather just improving code for linter sake. Either way this is an improvement. Ty :)

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 3, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 4, 2020
@techknowlogick techknowlogick merged commit 60cb9fe into go-gitea:master Jul 4, 2020
@techknowlogick techknowlogick added the backport/done All backports for this PR have been created label Jul 4, 2020
@zeripath zeripath deleted the re-fix-12095 branch July 4, 2020 14:37
silverwind added a commit to silverwind/gitea that referenced this pull request Jul 5, 2020
This gets the config closer to what 1.12 had.

Related: go-gitea#12129
zeripath pushed a commit that referenced this pull request Jul 5, 2020
This gets the config closer to what 1.12 had.

Related: #12129
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
For some reason our eslint configuration is not working correctly
and a bug has become apparent when trying to backport this to 1.12.

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
This gets the config closer to what 1.12 had.

Related: go-gitea#12129
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backport/done All backports for this PR have been created issue/critical This issue should be fixed ASAP. If it is a PR, the PR should be merged ASAP lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants