Skip to content
This repository has been archived by the owner on Dec 4, 2017. It is now read-only.

Commit

Permalink
0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Feb 9, 2015
0 parents commit 687c6e7
Show file tree
Hide file tree
Showing 27 changed files with 1,718 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
*.log
node_modules/
coverage/
5 changes: 5 additions & 0 deletions .istanbul.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
instrumentation:
excludes:
- lib/cli-engine.js
- lib/cli.js
- index.js
143 changes: 143 additions & 0 deletions .jscs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"plugins": [
"jscs-jsdoc"
],
"jsDoc": {
"checkAnnotations": "jsdoc3",
"checkParamNames": true,
"requireParamTypes": true,
"checkRedundantParams": true,
"checkReturnTypes": true,
"checkRedundantReturns": true,
"requireReturnTypes": true,
"checkTypes": "strictNativeCase",
"checkRedundantAccess": true,
"enforceExistence": true,
"requireHyphenBeforeDescription": true
},
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": true,
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"requireSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"requireBlocksOnNewline": true,
"disallowPaddingNewlinesInBlocks": true,
"disallowEmptyBlocks": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"requireSpacesInsideObjectBrackets": "all",
"disallowDanglingUnderscores": true,
"disallowSpaceAfterObjectKeys": true,
"requireCommaBeforeLineBreak": true,
"requireOperatorBeforeLineBreak": [
"?",
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!==",
">",
">=",
"<",
"<="
],
"requireSpaceBeforeBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"requireSpaceAfterBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"disallowSpaceAfterPrefixUnaryOperators": [
"++",
"--",
"+",
"-",
"~",
"!"
],
"disallowSpaceBeforePostfixUnaryOperators": [
"++",
"--"
],
"disallowImplicitTypeConversion": [
"numeric",
"boolean",
"binary",
"string"
],
"requireCamelCaseOrUpperCaseIdentifiers": true,
"disallowKeywords": [
"with"
],
"disallowMultipleLineStrings": true,
"disallowMultipleLineBreaks": true,
"validateLineBreaks": "LF",
"validateQuoteMarks": "'",
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowTrailingComma": true,
"disallowKeywordsOnNewLine": [
"else"
],
"requireLineFeedAtFileEnd": true,
"maximumLineLength": 78,
"requireCapitalizedConstructors": true,
"safeContextKeyword": "self",
"requireDotNotation": true,
"disallowYodaConditions": true,
"validateJSDoc": {
"checkParamNames": true,
"checkRedundantParams": true,
"requireParamTypes": true
}
}
10 changes: 10 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.*
*.log
*.sh
*.png
coverage/
doc/
node_modules/
script/
test/
History.md
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: node_js
script: npm run-script test-travis
node_js:
- '0.10'
- '0.11'
after_script: npm install [email protected] && cat ./coverage/lcov.info | coveralls
deploy:
provider: npm
email: [email protected]
api_key:
secure: Czw0zKRT+trt5ZccmdGvUDVnSlaRVD3C4Id0NMTeY8rmGq0tVfggjJgANGIIOMp9o5OpmEKdKG8XcrL7VgmVGUq5oyOh3Q5C+hke8VDTJvXb7lEltF0u7daXsZBLRbnLPBgxwlzToGhJWOa+oJllD/fX0IhE8MHI0IOqSqqo7y4=
on:
repo: wooorm/eslint-md
14 changes: 14 additions & 0 deletions Example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Hello World

```javascript
// Here is a tiny example of `eslint-md`:
process.stdout.write('Linting JavaScript in Markdown?')

document.title+='cool!!';

process.exit(1);
```




Empty file added History.md
Empty file.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
(The MIT License)

Copyright (c) 2015 Titus Wormer <[email protected]>

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.
70 changes: 70 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# eslint-md [![Build Status](https://img.shields.io/travis/wooorm/eslint-md.svg?style=flat)](https://travis-ci.org/wooorm/eslint-md) [![Coverage Status](https://img.shields.io/coveralls/wooorm/eslint-md.svg?style=flat)](https://coveralls.io/r/wooorm/eslint-md?branch=master)

Lint JavaScript in markdown code blocks with [ESLint](https://github.com/eslint/eslint).

**eslint-md** works exactly like **eslint** (such as supporting `.eslintrc` and `.eslintignore`), but lints the JavaScript code in Markdown code blocks (with a `js` or `javascript` code flag).

- **eslint-md**\([1](http://en.wikipedia.org/wiki/Man_page#Manual_sections)\) functions like ESLint’s [Command Line Interface](http://eslint.org/docs/command-line-interface/);
- **eslint-md**\([3](http://en.wikipedia.org/wiki/Man_page#Manual_sections)\) functions like ESLint’s [Node.js API](http://eslint.org/docs/developer-guide/nodejs-api.html).

![Example Screenshot](https://raw.github.com/wooorm/eslint-md/master/screenshot.png)

## Installation

[npm](https://docs.npmjs.com/cli/install):

```bash
$ npm install eslint-md
```

You probably want the CLI:

```bash
$ npm install --global eslint-md
```

## Usage

Refer to [ESLint’s docs](http://eslint.org/docs/) for more information regarding its functioning.

```text
Usage: eslint-md [options] file.md [file.md] [dir]
Lint JavaScript in markdown code-blocks with ESLint.
Options:
-h, --help Show help
-c, --config path::String Use configuration from this file
--rulesdir [path::String] Use additional rules from this directory
-f, --format String Use a specific output format - default: stylish
-v, --version Outputs the version number
--reset Set all default rules to off - default: false
--no-eslintrc Disable use of configuration from .eslintrc
--env [String] Specify environments
--ext [String] Specify Markdown file extensions - default: .md, .markd, .markdown
--plugin [String] Specify plugins
--global [String] Define global variables
--rule Object Specify rules
--ignore-path path::String Specify path of ignore file
--no-ignore Disable use of .eslintignore
--no-color Disable color in piped output
-o, --output-file path::String Specify file to write report to
--quiet Report errors only - default: false
--stdin Lint code provided on <STDIN> - default: false
# All ESLint features, such as `.eslintrc` and `.eslintignore` work!
Example:
# Pass all markdown files through eslint with options
$ eslint-md . --rule no-alert:false --global alert
# Readme.md
# 12:19 error Missing semicolon semi
#
# ✖ 1 problem (1 error, 0 warnings)
```

## License

[MIT](LICENSE) © [Titus Wormer](http://wooorm.com)
24 changes: 24 additions & 0 deletions bin/eslint-md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env node
/* This is an automatically generated script by `script/build.js` from `eslint`s source */

var concat = require("concat-stream"),
cli = require("../lib/cli");

var exitCode = 0,
useStdIn = (process.argv.indexOf("--stdin") > -1);

if (useStdIn) {
process.stdin.pipe(concat({ encoding: "string" }, function(text) {
exitCode = cli.execute(process.argv, text);
}));
} else {
exitCode = cli.execute(process.argv);
}

/*
* Wait for the stdout buffer to drain.
* See https://github.com/eslint/eslint/issues/317
*/
process.on("exit", function() {
process.exit(exitCode);
});
40 changes: 40 additions & 0 deletions doc/eslint-md.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# eslint-md(1) -- Lint JavaScript in markdown code-blocks

## SYNOPSIS

`eslint-md` [options] file.md [file.md] [dir]

## DESCRIPTION

**eslint-md** lints JavaScript in markdown code-blocks with ESLint.

Logs verbose debugging information when `$DEBUG` is set to `"eslint:*"`.

Options are as follows:

* `-h`, `--help`: Show help;
* `-c`, `--config` _path::String_: Use configuration from this file;
* `--rulesdir` [_path::String_]: Use additional rules from this directory;
* `-f`, `--format` _String_: Use a specific output format - default: stylish;
* `-v`, `--version`: Outputs the version number;
* `--reset`: Set all default rules to off - default: false;
* `--no-eslintrc`: Disable use of configuration from .eslintrc;
* `--env` [_String_]: Specify environments;
* `--ext` [_String_]: Specify Markdown file extensions - default: .md, .markd, .markdown;
* `--plugin` [_String_]: Specify plugins;
* `--global` [_String_]: Define global variables;
* `--rule` _Object_: Specify rules;
* `--ignore-path` _path::String_: Specify path of ignore file;
* `--no-ignore`: Disable use of .eslintignore;
* `--no-color`: Disable color in piped output;
* `-o`, `--output-file` _path::String_: Specify file to write report to;
* `--quiet`: Report errors only - default: false;
* `--stdin`: Lint code provided on <STDIN> - default: false.

## BUGS

<<https://github.com/wooorm/eslint-md/issues>>

## AUTHOR

Written by Titus Wormer <<[email protected]>>
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* This is an automatically generated script by `script/build.js` from `eslint`s source */
/**
* @fileoverview Expose out ESLint and CLI to require.
* @author Ian Christian Myers
*/

"use strict";

module.exports = {
linter: require("./lib/eslint-md"),
cli: require("./lib/cli"),
CLIEngine: require("./lib/cli-engine")
};
Loading

0 comments on commit 687c6e7

Please sign in to comment.