Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #93
- Loading branch information
Showing
33 changed files
with
1,238 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
const {isVersionAbsolute} = require('./../validators/dependency-audit'); | ||
const {areVersionsAbsolute} = require('./../validators/dependency-audit'); | ||
const LintIssue = require('./../LintIssue'); | ||
|
||
const lintId = 'no-absolute-version-dependencies'; | ||
const nodeName = 'dependencies'; | ||
const message = 'You are using an invalid version range. Please do not use absolute versions.'; | ||
const ruleType = 'standard'; | ||
const ruleType = 'optionalObject'; | ||
|
||
const lint = (packageJsonData, severity) => { | ||
if (packageJsonData.hasOwnProperty(nodeName) && isVersionAbsolute(packageJsonData, nodeName)) { | ||
const lint = (packageJsonData, severity, config) => { | ||
if (packageJsonData.hasOwnProperty(nodeName) && areVersionsAbsolute(packageJsonData, nodeName, config)) { | ||
return new LintIssue(lintId, severity, nodeName, message); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
module.exports.lint = lint; | ||
module.exports.ruleType = ruleType; | ||
module.exports = { | ||
lint, | ||
ruleType | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
const {isVersionAbsolute} = require('./../validators/dependency-audit'); | ||
const {areVersionsAbsolute} = require('./../validators/dependency-audit'); | ||
const LintIssue = require('./../LintIssue'); | ||
|
||
const lintId = 'no-absolute-version-devDependencies'; | ||
const nodeName = 'devDependencies'; | ||
const message = 'You are using an invalid version range. Please do not use absolute versions.'; | ||
const ruleType = 'standard'; | ||
const ruleType = 'optionalObject'; | ||
|
||
const lint = (packageJsonData, severity) => { | ||
if (packageJsonData.hasOwnProperty(nodeName) && isVersionAbsolute(packageJsonData, nodeName)) { | ||
const lint = (packageJsonData, severity, config) => { | ||
if (packageJsonData.hasOwnProperty(nodeName) && areVersionsAbsolute(packageJsonData, nodeName, config)) { | ||
return new LintIssue(lintId, severity, nodeName, message); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
module.exports.lint = lint; | ||
module.exports.ruleType = ruleType; | ||
module.exports = { | ||
lint, | ||
ruleType | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
const {isVersionAbsolute} = require('./../validators/dependency-audit'); | ||
const LintIssue = require('./../LintIssue'); | ||
const {doVersContainNonAbsolute} = require('../validators/dependency-audit'); | ||
const {exists} = require('../validators/property'); | ||
const LintIssue = require('../LintIssue'); | ||
|
||
const lintId = 'prefer-absolute-version-dependencies'; | ||
const nodeName = 'dependencies'; | ||
const message = 'You are using an invalid version range. Please use absolute versions.'; | ||
const ruleType = 'standard'; | ||
const ruleType = 'optionalObject'; | ||
|
||
const lint = (packageJsonData, severity) => { | ||
if (!isVersionAbsolute(packageJsonData, nodeName)) { | ||
const lint = (packageJsonData, severity, config) => { | ||
if (exists(packageJsonData, nodeName) && doVersContainNonAbsolute(packageJsonData, nodeName, config)) { | ||
return new LintIssue(lintId, severity, nodeName, message); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
module.exports.lint = lint; | ||
module.exports.ruleType = ruleType; | ||
module.exports = { | ||
lint, | ||
ruleType | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
const {isVersionAbsolute} = require('./../validators/dependency-audit'); | ||
const LintIssue = require('./../LintIssue'); | ||
const {doVersContainNonAbsolute} = require('../validators/dependency-audit'); | ||
const {exists} = require('../validators/property'); | ||
const LintIssue = require('../LintIssue'); | ||
|
||
const lintId = 'prefer-absolute-version-devDependencies'; | ||
const nodeName = 'devDependencies'; | ||
const message = 'You are using an invalid version range. Please use absolute versions.'; | ||
const ruleType = 'standard'; | ||
const ruleType = 'optionalObject'; | ||
|
||
const lint = (packageJsonData, severity) => { | ||
if (!isVersionAbsolute(packageJsonData, nodeName)) { | ||
const lint = (packageJsonData, severity, config) => { | ||
if (exists(packageJsonData, nodeName) && doVersContainNonAbsolute(packageJsonData, nodeName, config)) { | ||
return new LintIssue(lintId, severity, nodeName, message); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
module.exports.lint = lint; | ||
module.exports.ruleType = ruleType; | ||
module.exports = { | ||
lint, | ||
ruleType | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
const {areVersRangesValid} = require('./../validators/dependency-audit'); | ||
const {exists} = require('../validators/property'); | ||
const LintIssue = require('./../LintIssue'); | ||
|
||
const lintId = 'prefer-caret-version-dependencies'; | ||
const nodeName = 'dependencies'; | ||
const message = 'You are using an invalid version range. Please use ^.'; | ||
const ruleType = 'standard'; | ||
const ruleType = 'optionalObject'; | ||
|
||
const lint = (packageJsonData, severity) => { | ||
const lint = (packageJsonData, severity, config) => { | ||
const rangeSpecifier = '^'; | ||
|
||
if (!areVersRangesValid(packageJsonData, nodeName, rangeSpecifier)) { | ||
if (exists(packageJsonData, nodeName) && !areVersRangesValid(packageJsonData, nodeName, rangeSpecifier, config)) { | ||
return new LintIssue(lintId, severity, nodeName, message); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
module.exports.lint = lint; | ||
module.exports.ruleType = ruleType; | ||
module.exports = { | ||
lint, | ||
ruleType | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
const {areVersRangesValid} = require('./../validators/dependency-audit'); | ||
const {exists} = require('../validators/property'); | ||
const LintIssue = require('./../LintIssue'); | ||
|
||
const lintId = 'prefer-caret-version-devDependencies'; | ||
const nodeName = 'devDependencies'; | ||
const message = 'You are using an invalid version range. Please use ^.'; | ||
const ruleType = 'standard'; | ||
const ruleType = 'optionalObject'; | ||
|
||
const lint = (packageJsonData, severity) => { | ||
const lint = (packageJsonData, severity, config) => { | ||
const rangeSpecifier = '^'; | ||
|
||
if (!areVersRangesValid(packageJsonData, nodeName, rangeSpecifier)) { | ||
if (exists(packageJsonData, nodeName) && !areVersRangesValid(packageJsonData, nodeName, rangeSpecifier, config)) { | ||
return new LintIssue(lintId, severity, nodeName, message); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
module.exports.lint = lint; | ||
module.exports.ruleType = ruleType; | ||
module.exports = { | ||
lint, | ||
ruleType | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
const {hasDepVersZero} = require('./../validators/dependency-audit'); | ||
const {exists} = require('../validators/property'); | ||
const LintIssue = require('./../LintIssue'); | ||
|
||
const lintId = 'prefer-no-version-zero-dependencies'; | ||
const nodeName = 'dependencies'; | ||
const message = 'You have invalid version 0 dependencies. Please use modules with a major version >= 1.'; | ||
const ruleType = 'standard'; | ||
const ruleType = 'optionalObject'; | ||
|
||
const lint = (packageJsonData, severity) => { | ||
if (hasDepVersZero(packageJsonData, nodeName)) { | ||
const lint = (packageJsonData, severity, config) => { | ||
if (exists(packageJsonData, nodeName) && hasDepVersZero(packageJsonData, nodeName, config)) { | ||
return new LintIssue(lintId, severity, nodeName, message); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
module.exports.lint = lint; | ||
module.exports.ruleType = ruleType; | ||
module.exports = { | ||
lint, | ||
ruleType | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
const {hasDepVersZero} = require('./../validators/dependency-audit'); | ||
const {exists} = require('../validators/property'); | ||
const LintIssue = require('./../LintIssue'); | ||
|
||
const lintId = 'prefer-no-version-zero-devDependencies'; | ||
const nodeName = 'devDependencies'; | ||
const message = 'You have invalid version 0 dependencies. Please use modules with a major version >= 1.'; | ||
const ruleType = 'standard'; | ||
const ruleType = 'optionalObject'; | ||
|
||
const lint = (packageJsonData, severity) => { | ||
if (hasDepVersZero(packageJsonData, nodeName)) { | ||
const lint = (packageJsonData, severity, config) => { | ||
if (exists(packageJsonData, nodeName) && hasDepVersZero(packageJsonData, nodeName, config)) { | ||
return new LintIssue(lintId, severity, nodeName, message); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
module.exports.lint = lint; | ||
module.exports.ruleType = ruleType; | ||
module.exports = { | ||
lint, | ||
ruleType | ||
}; |
Oops, something went wrong.