Skip to content

Commit 1583429

Browse files
committed
Init repo with first version
1 parent a90c00a commit 1583429

File tree

115 files changed

+3901
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+3901
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Full documentation can be found at editorconfig.org
2+
# This requires a plugin to be installed in the editor of choice
3+
# Link to info on plugins can be found here - http://editorconfig.org/#download
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
indent_size = 2
10+
indent_style = space
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true

.gitattributes

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
* text eol=lf
4+
5+
# Denote all files that are truly binary and should not be modified.
6+
*.png binary
7+
*.eot binary
8+
*.woff binary

.gitignore

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
####################################
2+
####################################
3+
### OS Files
4+
####################################
5+
####################################
6+
Thumbs.db
7+
.DS_Store
8+
9+
10+
11+
12+
####################################
13+
####################################
14+
### Git
15+
####################################
16+
####################################
17+
*.orig
18+
19+
20+
21+
22+
####################################
23+
####################################
24+
### Sublime Text
25+
####################################
26+
####################################
27+
# cache files for sublime text
28+
*.tmlanguage.cache
29+
*.tmPreferences.cache
30+
*.stTheme.cache
31+
32+
# workspace files are user-specific
33+
*.sublime-workspace
34+
35+
# sublime project files
36+
*.sublime-project
37+
38+
# sftp configuration file
39+
sftp-config.json
40+
41+
42+
43+
44+
####################################
45+
####################################
46+
### Node
47+
####################################
48+
####################################
49+
# Logs
50+
logs
51+
*.log
52+
53+
# Coverage directory used by tools like istanbul
54+
coverage
55+
56+
# Compiled binary addons (http://nodejs.org/api/addons.html)
57+
build/Release
58+
59+
# Dependency directory
60+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
61+
node_modules
62+
63+
64+
65+
66+
####################################
67+
####################################
68+
### Mocha
69+
####################################
70+
####################################
71+
mocha.json

.jscsrc

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
{
2+
"disallowEmptyBlocks": true,
3+
"disallowKeywordsOnNewLine": ["else"],
4+
"disallowMixedSpacesAndTabs": true,
5+
"disallowMultipleLineStrings": true,
6+
"disallowMultipleVarDecl": true,
7+
"disallowNewlineBeforeBlockStatements": true,
8+
"disallowQuotedKeysInObjects": "allButReserved",
9+
"disallowSpaceAfterObjectKeys": true,
10+
"disallowSpaceAfterPrefixUnaryOperators": true,
11+
"disallowSpaceBeforePostfixUnaryOperators": true,
12+
"disallowSpacesInAnonymousFunctionExpression": {
13+
"beforeOpeningRoundBrace": true
14+
},
15+
"disallowSpacesInCallExpression": true,
16+
"disallowSpacesInFunction": {
17+
"beforeOpeningRoundBrace": true
18+
},
19+
"disallowSpacesInFunctionDeclaration": {
20+
"beforeOpeningRoundBrace": true
21+
},
22+
"disallowSpacesInNamedFunctionExpression": {
23+
"beforeOpeningRoundBrace": true
24+
},
25+
"disallowSpacesInsideArrayBrackets": "all",
26+
"disallowSpacesInsideObjectBrackets": "all",
27+
"disallowSpacesInsideParentheses": true,
28+
"disallowTrailingComma": true,
29+
"disallowYodaConditions": true,
30+
"requireBlocksOnNewline": true,
31+
"requireCapitalizedConstructors": true,
32+
"requireCommaBeforeLineBreak": true,
33+
"requireCurlyBraces": [
34+
"if",
35+
"else",
36+
"for",
37+
"while",
38+
"do",
39+
"try",
40+
"catch",
41+
"case",
42+
"default"
43+
],
44+
"requireDotNotation": true,
45+
"requireOperatorBeforeLineBreak": true,
46+
"requirePaddingNewlinesBeforeKeywords": [
47+
"do",
48+
"for",
49+
"switch",
50+
"case",
51+
"try",
52+
"void",
53+
"while",
54+
"with"
55+
],
56+
"requireParenthesesAroundIIFE": true,
57+
"requireSpaceAfterBinaryOperators": true,
58+
"requireSpaceAfterKeywords": [
59+
"do",
60+
"for",
61+
"else",
62+
"switch",
63+
"case",
64+
"try",
65+
"catch",
66+
"void",
67+
"while",
68+
"with",
69+
"return",
70+
"typeof"
71+
],
72+
"requireSpaceBeforeBinaryOperators": true,
73+
"requireSpaceBeforeBlockStatements": true,
74+
"requireSpaceBeforeKeywords": [
75+
"else",
76+
"while",
77+
"catch"
78+
],
79+
"requireSpaceBeforeObjectValues": true,
80+
"requireSpaceBetweenArguments": true,
81+
"requireSpacesInAnonymousFunctionExpression": {
82+
"beforeOpeningCurlyBrace": true
83+
},
84+
"requireSpacesInConditionalExpression": true,
85+
"requireSpacesInForStatement": true,
86+
"requireSpacesInFunction": {
87+
"beforeOpeningCurlyBrace": true
88+
},
89+
"requireSpacesInFunctionDeclaration": {
90+
"beforeOpeningCurlyBrace": true
91+
},
92+
"requireSpacesInNamedFunctionExpression": {
93+
"beforeOpeningCurlyBrace": true
94+
},
95+
"safeContextKeyword": [],
96+
"validateIndentation": 2,
97+
"validateParameterSeparator": ", ",
98+
"validateQuoteMarks": { "mark": "\"", "escape": true }
99+
}

.jshintrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"curly": true,
3+
"esversion": 6,
4+
"globals": {},
5+
"latedef": true,
6+
"maxdepth": 4,
7+
"maxstatements": 20,
8+
"mocha": true,
9+
"node": true,
10+
"nonbsp": true,
11+
"undef": true
12+
}

.npmignore

Whitespace-only changes.

Gruntfile.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module.exports = function(grunt) {
2+
// load in package.json to reference any data from it (like the version number)
3+
grunt.initConfig({
4+
pkg: grunt.file.readJSON("package.json")
5+
});
6+
// Load Grunt plugins from the config files in the grunt/ directory
7+
grunt.loadTasks("grunt");
8+
require("time-grunt")(grunt);
9+
10+
// Register task for running linters
11+
grunt.registerTask("lint", [
12+
"jsonlint",
13+
"jshint",
14+
"jscs"
15+
]);
16+
17+
// Register task for coverage
18+
// Note: This must be run separately. It cannot be run after the
19+
// normal tests run
20+
grunt.registerTask("coverage", [
21+
"clean",
22+
"env:coverage",
23+
"instrument",
24+
"mochaTest",
25+
"storeCoverage",
26+
"makeReport"
27+
]);
28+
29+
// Register task for local testing
30+
grunt.registerTask("local", [
31+
"lint",
32+
"mochaTest:local"
33+
]);
34+
35+
// default is just lint and mochaTest
36+
grunt.registerTask("default", [
37+
"lint",
38+
"mochaTest:local"
39+
]);
40+
};

README.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# package json lint
2+
3+
A package.json linter for Node projects
4+
5+
## What is package json lint?
6+
7+
package json lint helps enforce standards for your package.json file.
8+
Currently it can check for:
9+
10+
* validity of data types in nodes. Ex: `name` should always be a string.
11+
* whether a string is a lowercase
12+
* whether a version number is a valid
13+
* the presence of a given module
14+
* the presence of a pre-release version of a module
15+
16+
## How do I install it?
17+
First thing first, let's make sure you have the necessary pre-requisites.
18+
19+
### System Dependencies
20+
21+
#### Node
22+
* node - v4.2.0+
23+
* npm - v2.14.7+
24+
25+
### Use the cli
26+
27+
* `npm install package-json-lint -g`
28+
29+
## Commands and configuration
30+
31+
| Command | Alias | Description | README |
32+
|---|---|---|---|
33+
| pjl-cli --help | -h | Lists supported CLI options |
34+
| pjl-cli --version | -v | Lists the current version number |
35+
| pjl-cli --file <file path> | --f | File path including name. Defaults to package.json |
36+
| pjl-cli --rule <rule name> | --r | Valid rule name to check. Defaults to nothing |
37+
| pjl-cli --rules-file <file path> | --c | File path of .packagejsonlintrc |
38+
| pjl-cli --ignore-warnings | --w | Ignore warnings |
39+
40+
## Lint Rules
41+
42+
package json lint has a configurable set of rules. Each rule contains the following properties:
43+
44+
1. ID - example: author-required
45+
2. Type - error or warning
46+
3. Node - example: author
47+
4. Message - example: author is required
48+
5. Rule Type - example: required
49+
50+
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).

grunt/bump.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = function(grunt) {
2+
3+
grunt.config("bump", {
4+
options: {
5+
files: [
6+
"package.json"
7+
],
8+
commit: false,
9+
push: false,
10+
createTag: false
11+
}
12+
});
13+
14+
grunt.loadNpmTasks("grunt-bump");
15+
};

grunt/clean.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Cleans the dist directory (deletes all files)
3+
*/
4+
module.exports = function(grunt) {
5+
6+
grunt.config("clean", {
7+
coverage: {
8+
src: ["tests/coverage/"]
9+
}
10+
});
11+
12+
grunt.loadNpmTasks("grunt-contrib-clean");
13+
};

grunt/env.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = function(grunt) {
2+
3+
grunt.config("env", {
4+
coverage: {
5+
SRC_DIR_FOR_CODE_COVERAGE: "../tests/coverage/instrument/src/"
6+
}
7+
});
8+
9+
grunt.loadNpmTasks("grunt-env");
10+
};

grunt/istanbul.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Cleans the dist directory (deletes all files)
3+
*/
4+
module.exports = function(grunt) {
5+
6+
grunt.config("instrument", {
7+
files: "src/**/*.js",
8+
options: {
9+
lazy: true,
10+
basePath: "tests/coverage/instrument/"
11+
}
12+
});
13+
14+
grunt.config("storeCoverage", {
15+
options: {
16+
dir: "tests/coverage/reports"
17+
}
18+
});
19+
20+
grunt.config("makeReport", {
21+
src: "tests/coverage/reports/**/*.json",
22+
options: {
23+
type: "lcov",
24+
dir: "tests/coverage/reports",
25+
print: "detail"
26+
}
27+
});
28+
29+
grunt.loadNpmTasks("grunt-istanbul");
30+
};

grunt/jscs.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = function(grunt) {
2+
3+
grunt.config("jscs", {
4+
main: {
5+
options: {
6+
config: ".jscsrc"
7+
},
8+
src: [
9+
"src/**/*.js",
10+
"grunt/**/*.js",
11+
"tests/unit/**/*.js",
12+
"*.js"
13+
]
14+
}
15+
});
16+
17+
grunt.loadNpmTasks("grunt-jscs");
18+
};

0 commit comments

Comments
 (0)