eslint-plugin-sort-requires-fix
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -8,3 +8,3 @@ 'use strict'; | ||
exports.rules = { | ||
'sort-requires': require('./rules/sort-requires') | ||
'sort-requires-fix': require('./rules/sort-requires') | ||
}; |
@@ -6,3 +6,3 @@ /** | ||
exports.rules = { | ||
'sort-requires': require('./rules/sort-requires'), | ||
'sort-requires-fix': require('./rules/sort-requires'), | ||
}; |
{ | ||
"name": "eslint-plugin-sort-requires-fix", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "ESLint rule to enforce sorting of variable declarations in a group of require() calls", | ||
@@ -25,3 +25,3 @@ "main": "dist/index.js", | ||
"require", | ||
"sort-requires", | ||
"sort-requires-fix", | ||
"sorting" | ||
@@ -28,0 +28,0 @@ ], |
@@ -1,2 +0,2 @@ | ||
const rule = require('../../../lib').rules['sort-requires']; | ||
const rule = require('../../../lib').rules['sort-requires-fix']; | ||
const { RuleTester } = require('eslint'); | ||
@@ -7,29 +7,10 @@ | ||
ruleTester.run('sort-requires', rule, { | ||
ruleTester.run('sort-requires-fix', rule, { | ||
valid: [ | ||
code(['var a = require()', 'var b = require()']), | ||
code(['var a = require()', 'var b =', ' require()', 'var c = require()']), | ||
code(['var a = require()', 'var A = require()']), | ||
code(['var A = require()', 'var a = require()']), | ||
code(['var a = require()', 'var c = require()', '', 'var b = require()']), | ||
code([ | ||
'var a = require()', | ||
'var b = require()', | ||
]), | ||
code([ | ||
'var a = require()', | ||
'var b =', | ||
' require()', | ||
'var c = require()', | ||
]), | ||
code([ | ||
'var a = require()', | ||
'var A = require()', | ||
]), | ||
code([ | ||
'var A = require()', | ||
'var a = require()', | ||
]), | ||
code([ | ||
'var a = require()', | ||
'var c = require()', | ||
'', | ||
'var b = require()', | ||
]), | ||
code([ | ||
'var a = require()[0]', | ||
@@ -52,25 +33,11 @@ 'var b = require().test', | ||
{ | ||
code: code([ | ||
'const a = require()', | ||
'const b = require()', | ||
]), | ||
code: code(['const a = require()', 'const b = require()']), | ||
parserOptions: { ecmaVersion: 6 }, | ||
}, | ||
{ | ||
code: code([ | ||
'const b = require()', | ||
'let a = require()', | ||
]), | ||
code: code(['const b = require()', 'let a = require()']), | ||
parserOptions: { ecmaVersion: 6 }, | ||
}, | ||
code([ | ||
'var b = "hi"', | ||
'var a = "sup"', | ||
]), | ||
code([ | ||
'var a = require()', | ||
'var c = require()', | ||
'', | ||
'var b = require()', | ||
]), | ||
code(['var b = "hi"', 'var a = "sup"']), | ||
code(['var a = require()', 'var c = require()', '', 'var b = require()']), | ||
], | ||
@@ -80,45 +47,18 @@ | ||
{ | ||
code: code([ | ||
'var b = require().default', | ||
'var a = require()', | ||
]), | ||
output: code([ | ||
'var a = require()', | ||
'var b = require().default', | ||
]), | ||
code: code(['var b = require().default', 'var a = require()']), | ||
output: code(['var a = require()', 'var b = require().default']), | ||
errors: [{ message: 'This group of requires is not sorted' }], | ||
}, | ||
{ | ||
code: code([ | ||
'var b =', | ||
' require()', | ||
'var a = require()', | ||
]), | ||
output: code([ | ||
'var a = require()', | ||
'var b =', | ||
' require()', | ||
]), | ||
code: code(['var b =', ' require()', 'var a = require()']), | ||
output: code(['var a = require()', 'var b =', ' require()']), | ||
errors: [{ message: 'This group of requires is not sorted' }], | ||
}, | ||
{ | ||
code: code([ | ||
'var b =', | ||
'', | ||
' require()', | ||
'var a = require()', | ||
]), | ||
output: code([ | ||
'var a = require()', | ||
'var b =', | ||
'', | ||
' require()', | ||
]), | ||
code: code(['var b =', '', ' require()', 'var a = require()']), | ||
output: code(['var a = require()', 'var b =', '', ' require()']), | ||
errors: [{ message: 'This group of requires is not sorted' }], | ||
}, | ||
{ | ||
code: code([ | ||
'var { b } = require()', | ||
'var { a } = require()', | ||
]), | ||
code: code(['var { b } = require()', 'var { a } = require()']), | ||
errors: [{ message: 'This group of requires is not sorted' }], | ||
@@ -128,10 +68,4 @@ parserOptions: { ecmaVersion: 6 }, | ||
{ | ||
code: code([ | ||
'var { c, a } = require()', | ||
'var { b } = require()', | ||
]), | ||
output: code([ | ||
'var { b } = require()', | ||
'var { c, a } = require()', | ||
]), | ||
code: code(['var { c, a } = require()', 'var { b } = require()']), | ||
output: code(['var { b } = require()', 'var { c, a } = require()']), | ||
errors: [{ message: 'This group of requires is not sorted' }], | ||
@@ -141,6 +75,3 @@ parserOptions: { ecmaVersion: 6 }, | ||
{ | ||
code: code([ | ||
'var { b } = require()', | ||
'var a = require()', | ||
]), | ||
code: code(['var { b } = require()', 'var a = require()']), | ||
errors: [{ message: 'This group of requires is not sorted' }], | ||
@@ -150,10 +81,4 @@ parserOptions: { ecmaVersion: 6 }, | ||
{ | ||
code: code([ | ||
'let a = require()', | ||
'const B = require()', | ||
]), | ||
output: code([ | ||
'const B = require()', | ||
'let a = require()', | ||
]), | ||
code: code(['let a = require()', 'const B = require()']), | ||
output: code(['const B = require()', 'let a = require()']), | ||
errors: [{ message: 'This group of requires is not sorted' }], | ||
@@ -160,0 +85,0 @@ parserOptions: { ecmaVersion: 6 }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13789
302