Skip to content

Commit

Permalink
chore(release): 4.0.0 (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Oct 8, 2019
1 parent e3a6284 commit 91fffd7
Show file tree
Hide file tree
Showing 12 changed files with 6,712 additions and 5,904 deletions.
36 changes: 36 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"use strict";

module.exports = {
extends: [
"plugin:itgalaxy/script",
"plugin:itgalaxy/esnext",
"plugin:itgalaxy/node"
],
overrides: [
// Tests
{
extends: ["plugin:itgalaxy/dirty", "plugin:itgalaxy/jest"],
excludedFiles: ["**/*.md"],
files: ["**/__tests__/**/*", "**/__mocks__/**/*"],
rules: {
// Allow to use `console` (example - `mocking`)
"no-console": "off"
}
},

// Markdown
{
extends: ["plugin:itgalaxy/dirty", "plugin:itgalaxy/markdown"],
files: ["**/*.md"],
rules: {
"no-unused-vars": "off",
"no-console": "off",
"import/no-unresolved": "off",
"node/no-unpublished-require": "off",
"node/no-unpublished-import": "off",
"unicorn/filename-case": "off"
}
}
],
root: true
};
5 changes: 5 additions & 0 deletions .remarkrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

module.exports = {
plugins: ["remark-preset-lint-itgalaxy"]
};
12 changes: 5 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ git:
branches:
only:
- master
- /^greenkeeper/.*$/

language: node_js

Expand All @@ -19,22 +18,21 @@ cache:
matrix:
fast_finish: true
include:
- node_js: '11'
- node_js: "12"
script: npm run $JOB_PART
env: JOB_PART=pretest
- node_js: '10'
- node_js: "12"
script: npm run $JOB_PART
env: JOB_PART=test:only
- node_js: '10'
- node_js: "10"
script: npm run $JOB_PART
env: JOB_PART=test:only
- node_js: '8'
- node_js: "10"
script: npm run $JOB_PART
env: JOB_PART=test:only
- node_js: '6'
- node_js: "8"
script: npm run $JOB_PART
env: JOB_PART=test:only
sudo: required

before_install:
- npm install -g npm@latest
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](http://semver.org).

## 4.0.0 - 2019-10-08

- Feature: more rules.
- Changed: minimum require `node.js` version is `8.9.0`
- Chore: minimum require `npm-package-json-lint` is now `^4.0.0`.

## 3.0.0 - 2018-08-04

- Added: `description-format` rule.
Expand Down
58 changes: 53 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[![dependencies Status](https://david-dm.org/itgalaxy/npm-package-json-lint-config-itgalaxy/status.svg)](https://david-dm.org/itgalaxy/npm-package-json-lint-config-itgalaxy)
[![devDependencies Status](https://david-dm.org/itgalaxy/npm-package-json-lint-config-itgalaxy/dev-status.svg)](https://david-dm.org/itgalaxy/npm-package-json-lint-config-itgalaxy?type=dev)
[![peerDependencies Status](https://david-dm.org/itgalaxy/npm-package-json-lint-config-itgalaxy/peer-status.svg)](https://david-dm.org/itgalaxy/npm-package-json-lint-config-itgalaxy?type=peer)
[![Greenkeeper badge](https://badges.greenkeeper.io/itgalaxy/npm-package-json-lint-config-itgalaxy.svg)](https://greenkeeper.io)

## Installation

Expand All @@ -25,23 +24,72 @@ $ npm install npm-package-json-lint-config-itgalaxy --save-dev

Add the following to your `.npmpackagejsonlintrc.json` or `npmpackagejsonlint.config.js` file:

**.npmpackagejsonlintrc.json**

```json
{
"extends": "npm-package-json-lint-config-itgalaxy"
}
```

**npmpackagejsonlint.config.js**

```js
module.exports = {
extends: "npm-package-json-lint-config-itgalaxy"
};
```

If you need to override a rule, your `.npmpackagejsonlintrc.json` or `npmpackagejsonlint.config.js` file should look like the example below. All shared rules will be used, but `license-type` will be turned off.

```json
{
"extends": "npm-package-json-lint-config-itgalaxy",
"rules": {
**npmpackagejsonlint.config.js**

```js
module.exports = {
extends: "npm-package-json-lint-config-itgalaxy",
rules: {
"license-type": "off"
}
};
```

## FAQ

Q: My package contains only one file (for example: `index.js`)

A: Just use empty array of `files`:

**package.json**

```json
{
"files": []
}
```

---

Q: Do I need to list all files in `files` field

A: No. Some files always included in package. [More information](https://docs.npmjs.com/files/package.json#files).

---

Q: My package does not contain `js` files, it is just font/image/etc set.

A: Just disable `require-main` rule.

**npmpackagejsonlint.config.js**

```js
module.exports = {
extends: "npm-package-json-lint-config-itgalaxy",
rules: {
"require-main": "off"
}
};
```

## [Changelog](CHANGELOG.md)

## [License](LICENSE)
143 changes: 87 additions & 56 deletions __tests__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,60 +1,91 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`npm-package-json-lint-config-itgalaxy npm-package-json-lint should run without failing 1`] = `
Array [
LintIssue {
"lintId": "require-bugs",
"lintMessage": "bugs is required",
"node": "bugs",
"severity": "error",
},
LintIssue {
"lintId": "require-contributors",
"lintMessage": "contributors is required",
"node": "contributors",
"severity": "error",
},
LintIssue {
"lintId": "require-description",
"lintMessage": "description is required",
"node": "description",
"severity": "error",
},
LintIssue {
"lintId": "require-engines",
"lintMessage": "engines is required",
"node": "engines",
"severity": "error",
},
LintIssue {
"lintId": "require-files",
"lintMessage": "files is required",
"node": "files",
"severity": "error",
},
LintIssue {
"lintId": "require-homepage",
"lintMessage": "homepage is required",
"node": "homepage",
"severity": "error",
},
LintIssue {
"lintId": "require-keywords",
"lintMessage": "keywords is required",
"node": "keywords",
"severity": "error",
},
LintIssue {
"lintId": "require-license",
"lintMessage": "license is required",
"node": "license",
"severity": "error",
},
LintIssue {
"lintId": "require-repository",
"lintMessage": "repository is required",
"node": "repository",
"severity": "error",
},
]
Object {
"errorCount": 12,
"ignoreCount": 0,
"results": Array [
Object {
"errorCount": 12,
"filePath": "./fixtures/package.json",
"ignored": false,
"issues": Array [
LintIssue {
"lintId": "require-author",
"lintMessage": "author is required",
"node": "author",
"severity": "error",
},
LintIssue {
"lintId": "require-bugs",
"lintMessage": "bugs is required",
"node": "bugs",
"severity": "error",
},
LintIssue {
"lintId": "require-contributors",
"lintMessage": "contributors is required",
"node": "contributors",
"severity": "error",
},
LintIssue {
"lintId": "require-description",
"lintMessage": "description is required",
"node": "description",
"severity": "error",
},
LintIssue {
"lintId": "require-engines",
"lintMessage": "engines is required",
"node": "engines",
"severity": "error",
},
LintIssue {
"lintId": "require-files",
"lintMessage": "files is required",
"node": "files",
"severity": "error",
},
LintIssue {
"lintId": "require-homepage",
"lintMessage": "homepage is required",
"node": "homepage",
"severity": "error",
},
LintIssue {
"lintId": "require-keywords",
"lintMessage": "keywords is required",
"node": "keywords",
"severity": "error",
},
LintIssue {
"lintId": "require-license",
"lintMessage": "license is required",
"node": "license",
"severity": "error",
},
LintIssue {
"lintId": "require-main",
"lintMessage": "main is required",
"node": "main",
"severity": "error",
},
LintIssue {
"lintId": "require-repository",
"lintMessage": "repository is required",
"node": "repository",
"severity": "error",
},
LintIssue {
"lintId": "require-version",
"lintMessage": "version is required",
"node": "version",
"severity": "error",
},
],
"warningCount": 0,
},
],
"warningCount": 0,
}
`;
3 changes: 3 additions & 0 deletions __tests__/fixtures/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "test"
}
19 changes: 9 additions & 10 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
const path = require("path");
const { NpmPackageJsonLint } = require("npm-package-json-lint");
const isPlainObj = require("is-plain-obj");
const config = require("./..");

function lint(packageJsonData, packageConfig) {
return new NpmPackageJsonLint().lint(packageJsonData, packageConfig);
}
const config = require("..");

describe("npm-package-json-lint-config-itgalaxy", () => {
it("npm-package-json-lint config should be an object", () => {
Expand All @@ -16,11 +13,13 @@ describe("npm-package-json-lint-config-itgalaxy", () => {
});

it("npm-package-json-lint should run without failing", () => {
const packageJsonData = {
author: "Caitlin Snow"
};
const results = lint(packageJsonData, config.rules);
const npmPackageJsonLint = new NpmPackageJsonLint({
configFile: path.resolve(__dirname, "../index.js"),
cwd: path.resolve(__dirname),
patterns: ["fixtures"]
});
const results = npmPackageJsonLint.lint();

expect(results.issues).toMatchSnapshot();
expect(results).toMatchSnapshot();
});
});
Loading

0 comments on commit 91fffd7

Please sign in to comment.