Skip to content

Commit f8c3a30

Browse files
committed
Chore: setup
1 parent bcef6f1 commit f8c3a30

File tree

6 files changed

+214
-1
lines changed

6 files changed

+214
-1
lines changed

.eslintrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": ["mysticatea", "mysticatea/node"],
3+
"rules": {
4+
// It doesn't support rest parameters in Node 4.
5+
"prefer-rest-params": "off"
6+
}
7+
}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/.nyc_output
2+
/.vscode
3+
/coverage
4+
/index.js
5+
/node_modules
6+
/npm-debug.log
7+
/test.js

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- "4"
5+
- "6"
6+
after_success:
7+
- npm run codecov

README.md

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,91 @@
11
# eslint-plugin-eslint-comments
2-
Additional ESLint rules for directive comments of ESLint.
2+
3+
[![npm version](https://img.shields.io/npm/v/eslint-plugin-eslint-comments.svg)](https://www.npmjs.com/package/eslint-plugin-eslint-comments)
4+
[![Downloads/month](https://img.shields.io/npm/dm/eslint-plugin-eslint-comments.svg)](http://www.npmtrends.com/eslint-plugin-eslint-comments)
5+
[![Build Status](https://travis-ci.org/mysticatea/eslint-plugin-eslint-comments.svg?branch=master)](https://travis-ci.org/mysticatea/eslint-plugin-eslint-comments)
6+
[![codecov](https://codecov.io/gh/mysticatea/eslint-plugin-eslint-comments/branch/master/graph/badge.svg)](https://codecov.io/gh/mysticatea/eslint-plugin-eslint-comments)
7+
[![Dependency Status](https://david-dm.org/mysticatea/eslint-plugin-eslint-comments.svg)](https://david-dm.org/mysticatea/eslint-plugin-eslint-comments)
8+
9+
Additional ESLint rules for ESLint's directive comments (e.g. `//eslint-disable-line`).
10+
11+
## :cd: Installation
12+
13+
```
14+
npm install --save-dev eslint eslint-plugin-eslint-comments
15+
```
16+
17+
### Requirements
18+
19+
- Node.js `^4.0.0`, `^6.0.0`, or newer.
20+
- ESLint `^3.1.0`, or newer.
21+
22+
## :book: Usage
23+
24+
Write in your ESLint configurations: http://eslint.org/docs/user-guide/configuring#using-the-configuration-from-a-plugin
25+
26+
### Example
27+
28+
**.eslintrc.json**
29+
30+
```json
31+
{
32+
"plugins": [
33+
"eslint-comments"
34+
],
35+
"rules": {
36+
"eslint-comments/disable-enable-pair": "error",
37+
"eslint-comments/no-duplicate-disable": "error",
38+
"eslint-comments/no-unlimited-disable": "error",
39+
"eslint-comments/no-unused-disable": "error",
40+
"eslint-comments/no-use": "error",
41+
"eslint-comments/no-useless-enable": "error",
42+
}
43+
}
44+
```
45+
46+
### Rules
47+
48+
- [eslint-comments/disable-enable-pair](docs/rules/disable-enable-pair.md) requires a `eslint-enable` comment for every `eslint-disable` comment.
49+
- [eslint-comments/no-duplicate-disable](docs/rules/no-duplicate-disable.md) disallows duplicate `eslint-disable` comments.
50+
- [eslint-comments/no-unlimited-disable](docs/rules/no-unlimited-disable.md) disallows `eslint-disable` comments without rule names.
51+
- [eslint-comments/no-unused-disable](docs/rules/no-unused-disable.md) disallows unused `eslint-disable` comments.
52+
- [eslint-comments/no-use](docs/rules/no-use.md) disallows ESLint directive comments.
53+
- [eslint-comments/no-useless-enable](docs/rules/no-useless-enable.md) disallows useless `eslint-enable` comments.
54+
55+
## :anchor: Semantic Versioning Policy
56+
57+
`eslint-plugin-eslint-comments` follows [semantic versioning](http://semver.org/) and [ESLint's Semantic Versioning Policy](https://github.com/eslint/eslint#semantic-versioning-policy).
58+
59+
- Patch release (intended to not break your lint build)
60+
- A bug fix in a rule that results in `eslint-plugin-eslint-comments` reporting fewer errors.
61+
- Improvements to documentation.
62+
- Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage.
63+
- Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone).
64+
- Minor release (might break your lint build)
65+
- A bug fix in a rule that results in `eslint-plugin-eslint-comments` reporting more errors.
66+
- A new rule is created.
67+
- A new option to an existing rule is created.
68+
- An existing rule is deprecated.
69+
- Major release (likely to break your lint build)
70+
- A support for old Node version is dropped.
71+
- A support for old ESLint version is dropped.
72+
- An existing rule is removed.
73+
- An existing option of a rule is removed.
74+
- An existing config is updated.
75+
76+
## :newspaper: Changelog
77+
78+
- [GitHub Releases](https://github.com/mysticatea/eslint-plugin-eslint-comments/releases)
79+
80+
## :muscle: Contributing
81+
82+
Welcome contributing!
83+
84+
Please use GitHub's Issues/PRs.
85+
86+
### Development Tools
87+
88+
- `npm test` runs tests and measures coverage.
89+
- `npm run watch` runs tests and measures coverage when source code are changed.
90+
- `npm run coverage` shows the coverage result of `npm test` command.
91+
- `npm run clean` removes the coverage result of `npm test` command.

package.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "eslint-plugin-eslint-comments",
3+
"version": "0.0.0",
4+
"description": "Additional ESLint rules for directive comments of ESLint.",
5+
"engines": {
6+
"node": "^4.0.0 || >=6.0.0"
7+
},
8+
"main": "index.js",
9+
"files": [
10+
"lib"
11+
],
12+
"peerDependencies": {
13+
"eslint": ">=3.1.0"
14+
},
15+
"dependencies": {
16+
"escape-string-regexp": "^1.0.5"
17+
},
18+
"devDependencies": {
19+
"chokidar-cli": "^1.2.0",
20+
"codecov": "^1.0.1",
21+
"eslint": "^3.7.1",
22+
"eslint-config-mysticatea": "^6.0.0",
23+
"mocha": "^3.1.0",
24+
"npm-run-all": "^3.1.0",
25+
"nyc": "^8.3.1",
26+
"opener": "^1.4.2",
27+
"rimraf": "^2.5.4"
28+
},
29+
"scripts": {
30+
"preversion": "run-s clean test build",
31+
"postversion": "git push && git push --tags",
32+
"clean": "rimraf .nyc_output coverage index.js",
33+
"lint": "eslint lib scripts tests",
34+
"pretest": "npm run lint",
35+
"test": "nyc mocha \"tests/lib/**/*.js\" --reporter progress",
36+
"watch": "chokidar lib test --initial --command \"npm test && nyc report --reporter lcov\"",
37+
"coverage": "nyc report --reporter lcov && opener coverage/lcov-report/index.html",
38+
"codecov": "nyc report --reporter lcovonly && codecov"
39+
},
40+
"repository": {
41+
"type": "git",
42+
"url": "git+https://github.com/mysticatea/eslint-plugin-eslint-comments.git"
43+
},
44+
"keywords": [
45+
"eslint",
46+
"eslintplugin",
47+
"eslint-plugin",
48+
"plugin",
49+
"comment",
50+
"comments",
51+
"directive",
52+
"global",
53+
"globals",
54+
"exported",
55+
"eslint-env",
56+
"eslint-enable",
57+
"eslint-disable",
58+
"eslint-disable-line",
59+
"eslint-disable-next-line"
60+
],
61+
"author": "Toru Nagashima",
62+
"license": "MIT",
63+
"bugs": {
64+
"url": "https://github.com/mysticatea/eslint-plugin-eslint-comments/issues"
65+
},
66+
"homepage": "https://github.com/mysticatea/eslint-plugin-eslint-comments#readme"
67+
}

scripts/generate-index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* @author Toru Nagashima
3+
* @copyright 2016 Toru Nagashima. All rights reserved.
4+
* See LICENSE file in root directory for full license.
5+
*/
6+
"use strict"
7+
8+
//------------------------------------------------------------------------------
9+
// Requirements
10+
//------------------------------------------------------------------------------
11+
12+
const fs = require("fs")
13+
const path = require("path")
14+
15+
//------------------------------------------------------------------------------
16+
// Main
17+
//------------------------------------------------------------------------------
18+
19+
fs.writeFileSync(path.resolve(__dirname, "../index.js"), `/**
20+
* @author Toru Nagashima
21+
* @copyright 2016 Toru Nagashima. All rights reserved.
22+
* See LICENSE file in root directory for full license.
23+
*/
24+
"use strict"
25+
26+
module.exports = {
27+
rules: {
28+
${
29+
fs.readdirSync(path.resolve(__dirname, "../lib/rules"))
30+
.map(fileName => path.basename(fileName, ".js"))
31+
.map(ruleId => ` "${ruleId}": require("./lib/rules/${ruleId}"),`)
32+
.join("\n")
33+
}
34+
},
35+
}
36+
`)

0 commit comments

Comments
 (0)