From 8b0ae4f30014e9526af02ecba518f5edfd38c2b9 Mon Sep 17 00:00:00 2001 From: Teddy Katz Date: Tue, 13 Dec 2016 17:20:52 -0500 Subject: [PATCH] New: initial commit --- .eslintrc.yml | 8 ++++++++ .gitignore | 1 + .travis.yml | 5 +++++ LICENSE.md | 25 +++++++++++++++++++++++++ README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ lib/index.js | 25 +++++++++++++++++++++++++ package.json | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/.gitkeep | 0 8 files changed, 152 insertions(+) create mode 100644 .eslintrc.yml create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 LICENSE.md create mode 100644 README.md create mode 100644 lib/index.js create mode 100644 package.json create mode 100644 tests/.gitkeep diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 00000000..57596967 --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,8 @@ +extends: + - not-an-aardvark/node + - plugin:node/recommended +plugins: + - node +root: true +rules: + require-jsdoc: error diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..f0a493ae --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - '4' + - '6' + - '7' diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..9c427277 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,25 @@ +The MIT License (MIT) +===================== + +Copyright © 2016 Teddy Katz + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the “Software”), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..d45adb1f --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# eslint-plugin-eslint-plugin + +An ESLint plugin for linting ESLint plugins + +## Installation + +You'll first need to install [ESLint](http://eslint.org): + +``` +$ npm i eslint --save-dev +``` + +Next, install `eslint-plugin-eslint-plugin`: + +``` +$ npm install eslint-plugin-eslint-plugin --save-dev +``` + +**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-eslint-plugin` globally. + +## Usage + +Add `eslint-plugin` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: + +```json +{ + "plugins": [ + "eslint-plugin" + ] +} +``` + + +Then configure the rules you want to use under the rules section. + +```json +{ + "rules": { + "eslint-plugin/new-report-api": "error" + } +} +``` + +## Supported Rules + +* None yet diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 00000000..f419ac50 --- /dev/null +++ b/lib/index.js @@ -0,0 +1,25 @@ +/** + * @fileoverview An ESLint plugin for linting ESLint plugins + * @author Teddy Katz + */ + +'use strict'; + +// ------------------------------------------------------------------------------ +// Requirements +// ------------------------------------------------------------------------------ + +const fs = require('fs'); +const path = require('path'); + +// ------------------------------------------------------------------------------ +// Plugin Definition +// ------------------------------------------------------------------------------ + + +// import all rules in lib/rules +module.exports.rules = fs + .readdirSync(`${__dirname}/rules`) + .filter(fileName => fileName.endsWith('.js') && /^[^._]/.test(fileName)) + .map(fileName => fileName.replace(/\.js$/, '')) + .reduce((rules, ruleName) => Object.assign(rules, { [ruleName]: require(path.join(__dirname, 'rules', ruleName)) }), {}); diff --git a/package.json b/package.json new file mode 100644 index 00000000..ca65612c --- /dev/null +++ b/package.json @@ -0,0 +1,42 @@ +{ + "name": "eslint-plugin-eslint-plugin", + "version": "0.0.0", + "description": "An ESLint plugin for linting ESLint plugins", + "author": "Teddy Katz", + "main": "lib/index.js", + "license": "MIT", + "scripts": { + "lint": "eslint .", + "pretest": "npm run lint", + "test": "mocha tests --recursive" + }, + "files": [ + "lib/" + ], + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin.git" + }, + "bugs": { + "url": "https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin/issues" + }, + "homepage": "https://github.com/not-an-aardvark/eslint-plugin-eslint-plugin#readme", + "dependencies": {}, + "devDependencies": { + "eslint": "^3.12.1", + "eslint-config-not-an-aardvark": "^2.0.0", + "eslint-plugin-node": "^3.0.5", + "mocha": "^2.4.5" + }, + "peerDependencies": { + "eslint": "^3.12.1" + }, + "engines": { + "node": ">=4.0.0" + } +} diff --git a/tests/.gitkeep b/tests/.gitkeep new file mode 100644 index 00000000..e69de29b