Skip to content

Commit

Permalink
fix: wrap iife inside
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed Dec 6, 2017
1 parent e67069e commit 4dab480
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ module.exports = {
'radix': 'warn',
'require-await': 'error',
'vars-on-top': 'off', // todo: maybe warn later
'wrap-iife': 'error',
'wrap-iife': ['error', 'inside'],
'yoda': 'error',

// Strict Mode (https://eslint.org/docs/rules/#strict-mode)
Expand Down
4 changes: 4 additions & 0 deletions test/not-ok.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ function A() {

new A();

(function f() {
return 1;
}());

// use this function to mark a variable as used
function useIt(...vals) {
return vals;
Expand Down
4 changes: 4 additions & 0 deletions test/ok.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ function A() {

useIt(new A());

(function f() {
return 1;
})();

// use this function to mark a variable as used
function useIt(...vals) {
return vals;
Expand Down
1 change: 1 addition & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ assert.deepStrictEqual(errors, [
'quote-props',
'quotes',
'strict',
'wrap-iife'
]);

0 comments on commit 4dab480

Please sign in to comment.