Skip to content

Commit b686f8f

Browse files
committed
Rename package
1 parent 70fb711 commit b686f8f

9 files changed

+42
-42
lines changed

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ Run `node src/cli.js`
3131

3232
### JS
3333

34-
package json lint utilizes both JSHint and JSCS to enforce JavaScript standards. Please see the `.jshintrc` file for JSHint config and `.jscsrc` for JSCS config.
34+
npm package json lint utilizes both JSHint and JSCS to enforce JavaScript standards. Please see the `.jshintrc` file for JSHint config and `.jscsrc` for JSCS config.
3535

3636
* [grunt-contrib-jshint](https://github.com/gruntjs/grunt-contrib-jshint)
3737
* [grunt-jscs](https://github.com/jscs-dev/grunt-jscs)
3838

3939
#### JSON
4040

41-
package json lint utilizes JSON Lint to ensure JSON files are valid.
41+
npm package json lint utilizes JSON Lint to ensure JSON files are valid.
4242

4343
* [grunt-jsonlint](https://github.com/brandonramirez/grunt-jsonlint)
4444

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# package json lint
1+
# npm package json lint
22

33
A package.json linter for Node projects
44

55
## What is package json lint?
66

7-
package json lint helps enforce standards for your package.json file.
7+
npm package json lint helps enforce standards for your package.json file.
88
Currently it can check for:
99

1010
* validity of data types in nodes. Ex: `name` should always be a string.
@@ -36,7 +36,7 @@ First thing first, let's make sure you have the necessary pre-requisites.
3636
| pjl-cli --version | -v | Lists the current version number |
3737
| pjl-cli --file <file path> | --f | File path including name. Defaults to package.json |
3838
| pjl-cli --rule <rule name> | --r | Valid rule name to check. Defaults to nothing |
39-
| pjl-cli --rules-file <file path> | --c | File path of .packagejsonlintrc |
39+
| pjl-cli --rules-file <file path> | --c | File path of .npmpackagejsonlintrc |
4040
| pjl-cli --ignore-warnings | --w | Ignore warnings |
4141

4242
### Examples
@@ -47,23 +47,23 @@ Run a specific rule, author-valid-values, on a file relative to the current work
4747
Run a specific rule, author-valid-values, ignoring warnings on a file relative to the current working directory.
4848
`pjl-cli -f "../relative-path/package.json" -r "author-valid-values: true" --ignore-warnings`
4949

50-
Run using the config in `.packagejsonlintrc` on a file relative to the current working directory.
51-
`pjl-cli -f "../relative-path/package.json" -c "./.packagejsonlintrc"`
50+
Run using the config in `.npmpackagejsonlintrc` on a file relative to the current working directory.
51+
`pjl-cli -f "../relative-path/package.json" -c "./.npmpackagejsonlintrc"`
5252

5353
Run using the default config on a file relative to the current working directory
5454
`pjl-cli -f "../relative-path/package.json"`
5555

5656
## Lint Rules
5757

58-
package json lint has a configurable set of rules. Each rule contains the following properties:
58+
npm package json lint has a configurable set of rules. Each rule contains the following properties:
5959

6060
1. ID - example: author-required
6161
2. Type - error or warning
6262
3. Node - example: author
6363
4. Message - example: author is required
6464
5. Rule Type - example: required
6565

66-
As mentioned in the "Commands and configuration" section there are two ways to specify rule sets. The first is using `--rule` to specify a given rule. This will run package json lint with just this rule. The second is using `--rules-file` to specify a JSON file, named `.packagejsonlintrc`, to run a set of rules. If neither of the options above are specified then package json lint looks for a global `.packagejsonlintrc` file in the root of your user directory. Finally, if a global `.packagejsonlintrc` file doesn't exist then all rules are enabled by [default](src/defaultConfig.js).
66+
As mentioned in the "Commands and configuration" section there are two ways to specify rule sets. The first is using `--rule` to specify a given rule. This will run package json lint with just this rule. The second is using `--rules-file` to specify a JSON file, named `.npmpackagejsonlintrc`, to run a set of rules. If neither of the options above are specified then package json lint looks for a global `.npmpackagejsonlintrc` file in the root of your user directory. Finally, if a global `.npmpackagejsonlintrc` file doesn't exist then all rules are enabled by [default](src/defaultConfig.js).
6767

6868
## Contributing
6969

grunt/jsonlint.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = function(grunt) {
99
"*.json",
1010
".jscsrc",
1111
".jshintrc",
12-
".packagejsonlintrc"
12+
".npmpackagejsonlintrc"
1313
]
1414
}
1515
});

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"bin": {
2222
"pjl-cli": "src/cli.js"
2323
},
24-
"main": "src/PackageJsonLint.js",
24+
"main": "src/NpmPackageJsonLint.js",
2525
"dependencies": {
2626
"chalk": "^1.1.1",
2727
"commander": "^2.9.0",

src/PackageJsonLint.js renamed to src/NpmPackageJsonLint.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ let Config = require("./Config");
55
let isPlainObj = require("is-plain-obj");
66
let Rules = require("./Rules");
77

8-
class PackageJsonLint {
8+
class NpmPackageJsonLint {
99
/**
1010
* constructor
1111
* @param {object} packageJsonData Valid package.json data
@@ -96,4 +96,4 @@ class PackageJsonLint {
9696
}
9797
}
9898

99-
module.exports = PackageJsonLint;
99+
module.exports = NpmPackageJsonLint;

src/Parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Parser {
99
* @return {object} Valid JavaScript object
1010
*/
1111
parse(fileName) {
12-
// Make sure that a .packagejsonlint.rc is present
12+
// Make sure that a .npmpackagejsonlintrc is present
1313
try {
1414
return this._readFile(fileName);
1515
} catch (e) {

src/cli.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ let fs = require("fs");
88
let Parser = require("./Parser");
99
let path = require("path");
1010
let pkg = require("./../package.json");
11-
let PackageJsonLint = require("./PackageJsonLint");
11+
let NpmPackageJsonLint = require("./NpmPackageJsonLint");
1212
let Reporter = require("./Reporter");
1313
let userHome = require("user-home");
1414

1515
const DEFAULT_FILE_NAME = "./package.json";
16-
const PACKAGE_JSON_RC_FILE_NAME = ".packagejsonlintrc";
16+
const NPM_PACKAGE_JSON_RC_FILE_NAME = ".npmpackagejsonlintrc";
1717

1818
function handleError(err) {
1919
console.log(chalk.red.bold(err));
@@ -25,7 +25,7 @@ cliApp.version(pkg.version);
2525
cliApp.usage(pkg.name);
2626
cliApp.option("-f, --file <filePath>", `File path including name. Defaults to ${DEFAULT_FILE_NAME}`, DEFAULT_FILE_NAME);
2727
cliApp.option("-r, --rule <rule name>", "Valid rule name to check. Defaults to nothing");
28-
cliApp.option("-c, --rules-file <filePath>", "File path of .packagejsonlintrc");
28+
cliApp.option("-c, --rules-file <filePath>", "File path of .npmpackagejsonlintrc");
2929
cliApp.option("-w, --ignore-warnings", "Ignore warnings");
3030
cliApp.parse(process.argv);
3131

@@ -56,7 +56,7 @@ if (typeof cliApp.rulesFile !== "undefined") {
5656
// check if rules have been found. If no, then lets try to find a config file in
5757
// the user's home directory
5858
if (!rulesLoaded) {
59-
let userHomeRcFile = path.join(userHome, PACKAGE_JSON_RC_FILE_NAME);
59+
let userHomeRcFile = path.join(userHome, NPM_PACKAGE_JSON_RC_FILE_NAME);
6060

6161
if (fs.existsSync(userHomeRcFile)) {
6262
rulesConfig = userHomeRcFile;
@@ -70,8 +70,8 @@ try {
7070
let parser = new Parser();
7171
fileData = parser.parse(filePath);
7272

73-
let packageJsonLint = new PackageJsonLint(fileData, rulesConfig, options);
74-
let output = packageJsonLint.lint();
73+
let npmPackageJsonLint = new NpmPackageJsonLint(fileData, rulesConfig, options);
74+
let output = npmPackageJsonLint.lint();
7575

7676
let reporter = new Reporter();
7777

tests/unit/ConfigTest.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ describe("Config Unit Tests", function() {
3131
});
3232
});
3333

34-
context("when a relative path string to a .packagejsonlintrc file is passed", function() {
34+
context("when a relative path string to a .npmpackagejsonlintrc file is passed", function() {
3535
it("the config object should return the parsed JSON as an object", function() {
36-
let passedConfig = "./.packagejsonlintrc";
36+
let passedConfig = "./.npmpackagejsonlintrc";
3737
let config = new Config(passedConfig);
3838
let obj = {
3939
"version-type": true
@@ -44,9 +44,9 @@ describe("Config Unit Tests", function() {
4444
});
4545
});
4646

47-
context("when an absolute path string to a .packagejsonlintrc file is passed", function() {
47+
context("when an absolute path string to a .npmpackagejsonlintrc file is passed", function() {
4848
it("the config object should return the parsed JSON as an object", function() {
49-
let passedConfig = "/Users/awesomeUser/.packagejsonlintrc";
49+
let passedConfig = "/Users/awesomeUser/.npmpackagejsonlintrc";
5050
let config = new Config(passedConfig);
5151
let obj = {
5252
"version-type": true

tests/unit/PackageJsonLintTest.js renamed to tests/unit/NpmPackageJsonLintTest.js

+18-18
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ let fs = require("fs");
44
let should = require("should");
55
let sinon = require("sinon");
66
let requireHelper = require("../require_helper");
7-
let PackageJsonLint = requireHelper("PackageJsonLint");
7+
let NpmPackageJsonLint = requireHelper("NpmPackageJsonLint");
88

9-
describe("PackageJsonLint Unit Tests", function() {
9+
describe("NpmPackageJsonLint Unit Tests", function() {
1010
describe("lint method", function() {
1111
context("validate that errors and warnings are set", function() {
1212
it("two errors and zero warnings expected", function() {
@@ -21,14 +21,14 @@ describe("PackageJsonLint Unit Tests", function() {
2121
let options = {
2222
ignoreWarnings: false
2323
};
24-
let packageJsonLint = new PackageJsonLint(packageJsonData, config, options);
24+
let npmPackageJsonLint = new NpmPackageJsonLint(packageJsonData, config, options);
2525
let rules = {
2626
"description-type": "rules\\description-type.js",
2727
"name-format": "rules\\name-format.js"
2828
};
29-
let rulesStub = sinon.stub(packageJsonLint, "_loadRules").returns(rules);
30-
let configStub = sinon.stub(packageJsonLint, "_getConfig").returns(config);
31-
let response = packageJsonLint.lint();
29+
let rulesStub = sinon.stub(npmPackageJsonLint, "_loadRules").returns(rules);
30+
let configStub = sinon.stub(npmPackageJsonLint, "_getConfig").returns(config);
31+
let response = npmPackageJsonLint.lint();
3232
response.errors.length.should.equal(2);
3333
response.warnings.length.should.equal(0);
3434
});
@@ -46,14 +46,14 @@ describe("PackageJsonLint Unit Tests", function() {
4646
let options = {
4747
ignoreWarnings: false
4848
};
49-
let packageJsonLint = new PackageJsonLint(packageJsonData, config, options);
49+
let npmPackageJsonLint = new NpmPackageJsonLint(packageJsonData, config, options);
5050
let rules = {
5151
"keywords-recommended": "rules\\keywords-recommended.js",
5252
"name-format": "rules\\name-format.js"
5353
};
54-
let rulesStub = sinon.stub(packageJsonLint, "_loadRules").returns(rules);
55-
let configStub = sinon.stub(packageJsonLint, "_getConfig").returns(config);
56-
let response = packageJsonLint.lint();
54+
let rulesStub = sinon.stub(npmPackageJsonLint, "_loadRules").returns(rules);
55+
let configStub = sinon.stub(npmPackageJsonLint, "_getConfig").returns(config);
56+
let response = npmPackageJsonLint.lint();
5757
response.errors.length.should.equal(1);
5858
response.warnings.length.should.equal(1);
5959
});
@@ -71,14 +71,14 @@ describe("PackageJsonLint Unit Tests", function() {
7171
let options = {
7272
ignoreWarnings: true
7373
};
74-
let packageJsonLint = new PackageJsonLint(packageJsonData, config, options);
74+
let npmPackageJsonLint = new NpmPackageJsonLint(packageJsonData, config, options);
7575
let rules = {
7676
"keywords-recommended": "rules\\keywords-recommended.js",
7777
"name-format": "rules\\name-format.js"
7878
};
79-
let rulesStub = sinon.stub(packageJsonLint, "_loadRules").returns(rules);
80-
let configStub = sinon.stub(packageJsonLint, "_getConfig").returns(config);
81-
let response = packageJsonLint.lint();
79+
let rulesStub = sinon.stub(npmPackageJsonLint, "_loadRules").returns(rules);
80+
let configStub = sinon.stub(npmPackageJsonLint, "_getConfig").returns(config);
81+
let response = npmPackageJsonLint.lint();
8282
response.errors.length.should.equal(1);
8383
response.hasOwnProperty("warnings").should.be.false();
8484
});
@@ -98,13 +98,13 @@ describe("PackageJsonLint Unit Tests", function() {
9898
let options = {
9999
ignoreWarnings: true
100100
};
101-
let packageJsonLint = new PackageJsonLint(packageJsonData, config, options);
101+
let npmPackageJsonLint = new NpmPackageJsonLint(packageJsonData, config, options);
102102
let rules = {
103103
"author-valid-values": "rules\\author-valid-values.js"
104104
};
105-
let rulesStub = sinon.stub(packageJsonLint, "_loadRules").returns(rules);
106-
let configStub = sinon.stub(packageJsonLint, "_getConfig").returns(config);
107-
let response = packageJsonLint.lint();
105+
let rulesStub = sinon.stub(npmPackageJsonLint, "_loadRules").returns(rules);
106+
let configStub = sinon.stub(npmPackageJsonLint, "_getConfig").returns(config);
107+
let response = npmPackageJsonLint.lint();
108108
response.errors.length.should.equal(1);
109109
response.hasOwnProperty("warnings").should.be.false();
110110
});

0 commit comments

Comments
 (0)