Skip to content

Commit

Permalink
Refactor code-style to use xo
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Aug 18, 2016
1 parent be0eac7 commit 904aaee
Show file tree
Hide file tree
Showing 127 changed files with 9,708 additions and 10,555 deletions.
8 changes: 1 addition & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@ root = true

[*]
indent_style = space
indent_size = 4
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{json,svg,eslintrc}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
5 changes: 0 additions & 5 deletions .eslintignore

This file was deleted.

6 changes: 0 additions & 6 deletions .eslintrc

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
*.log
node_modules
coverage
remark.js
remark.min.js
/remark.js
/remark.min.js
42 changes: 0 additions & 42 deletions .jscs.json

This file was deleted.

48 changes: 24 additions & 24 deletions .remarkrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
*/

module.exports = {
'output': true,
'plugins': {
// 'comment-config': null,
// 'github': null,
// 'validate-links': null,
'toc': {
'maxDepth': 3,
'tight': true
},
'lint': {
/* `h6` for signatures. */
'no-duplicate-headings': false,
'heading-increment': false,
'output': true,
'plugins': {
'comment-config': null,
'github': null,
'validate-links': null,
'toc': {
'maxDepth': 3,
'tight': true
},
'lint': {
/* `h6` for signatures. */
'no-duplicate-headings': false,
'heading-increment': false,

/* Lists. */
'list-item-spacing': false,
'no-missing-blank-lines': false
},
"github": null,
"comment-config": null,
"validate-links": null
/* Lists. */
'list-item-spacing': false,
'no-missing-blank-lines': false
},
'settings': {
/* I personally like asterisks. */
'bullet': '*'
}
"github": null,
"comment-config": null,
"validate-links": null
},
'settings': {
/* I personally like asterisks. */
'bullet': '*'
}
};
9 changes: 3 additions & 6 deletions doc/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,23 +155,20 @@ var html = require('remark-html');
var report = require('vfile-reporter');

remark().use(lint).use(html).process('## Hello world!', function (err, file) {
file.filename = 'example';
file.extension = 'md';
console.log(file.toString());
console.error(report(file));
console.error(report(err || file));
console.log(String(file));
});
```

`node index.js` yields:

```txt
<h2>Hello world!</h2>
example.md:
1:1 warning Missing newline character at end of file final-newline
1:1-1:16 warning First heading level should be `1` first-heading-level
1:1-1:16 warning Don’t add a trailing `!` to headings no-heading-punctuation
⚠ 3 warnings
<h2>Hello world!</h2>
```

<!-- Definitions -->
Expand Down
40 changes: 28 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@
"devDependencies": {
"bail": "^1.0.0",
"browserify": "^13.0.0",
"bundle-collapser": "^1.2.1",
"camelcase": "^3.0.0",
"chalk": "^1.1.3",
"clone": "^1.0.2",
"escodegen": "^1.7.0",
"eslint": "^3.3.0",
"esmangle": "^1.0.0",
"esprima": "^2.6.0",
"execa": "^0.4.0",
"extend": "^3.0.0",
"jscs": "^3.0.0",
"jscs-jsdoc": "^2.0.0",
"has": "^1.0.1",
"lerna": "2.0.0-beta.20",
"mdast-util-assert": "^1.0.0",
"mdast-util-compact": "^1.0.0",
"nyc": "^8.0.0",
"remark-comment-config": "^4.0.0",
"remark-github": "^5.0.0",
Expand All @@ -27,7 +28,11 @@
"remark-validate-links": "^4.0.0",
"tape": "^4.5.1",
"uglifyify": "^3.0.1",
"vfile": "^1.4.0"
"unist-builder": "^1.0.2",
"unist-util-remove-position": "^1.1.0",
"unist-util-visit": "^1.1.0",
"vfile": "^1.4.0",
"xo": "^0.16.0"
},
"nyc": {
"check-coverage": true,
Expand All @@ -40,14 +45,25 @@
"build-md": "packages/remark-cli/cli.js . --frail --quiet",
"build-bundle": "node script/build-bundle.js",
"build": "npm run build-md && npm run build-bundle",
"lint-api": "eslint .",
"lint-style": "jscs --reporter inline .",
"lint": "npm run lint-api && npm run lint-style",
"test-api": "node test",
"test-api-extensive": "TEST_EXTENDED=true node test",
"lint": "xo",
"test-api": "node test/api",
"test-api-extensive": "TEST_EXTENDED=true node test/api",
"test-cli": "node test/cli.js",
"test-coverage": "nyc --reporter lcov tape test/index.js test/cli.js",
"test-travis": "npm run build-md && npm run build-bundle && npm run lint && npm run test-coverage && npm run test-cli",
"test": "npm run build && npm run lint && npm run test-coverage && npm run test-cli"
"test-coverage": "nyc --reporter lcov tape test",
"test": "npm run build && npm run lint && npm run test-coverage"
},
"xo": {
"space": true,
"rules": {
"eqeqeq": "off",
"guard-for-in": "off",
"max-lines": "off",
"max-depth": "off",
"complexity": "off",
"no-eq-null": "off"
},
"ignores": [
"remark.js"
]
}
}
30 changes: 15 additions & 15 deletions packages/remark-cli/cli.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
#!/usr/bin/env node
/**
* @author Titus Wormer
* @copyright 2015-2016 Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module remark:cli
* @fileoverview CLI to process markdown.
*/

'use strict';

/* eslint-env node */

/* Dependencies. */
var start = require('unified-args');
var extensions = require('markdown-extensions');
var processor = require('remark');
var proc = require('remark/package.json');
var cli = require('./package.json');

/* Start. */
start({
'processor': processor,
'name': proc.name,
'description': cli.description,
'version': [
proc.name + ': ' + proc.version,
cli.name + ': ' + cli.version
].join(', '),
'pluginPrefix': proc.name,
'packageField': proc.name + 'Config',
'rcName': '.' + proc.name + 'rc',
'ignoreName': '.' + proc.name + 'ignore',
'extensions': extensions
processor: processor,
name: proc.name,
description: cli.description,
version: [
proc.name + ': ' + proc.version,
cli.name + ': ' + cli.version
].join(', '),
pluginPrefix: proc.name,
packageField: proc.name + 'Config',
rcName: '.' + proc.name + 'rc',
ignoreName: '.' + proc.name + 'ignore',
extensions: extensions
});
16 changes: 6 additions & 10 deletions packages/remark-parse/index.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
/**
* @author Titus Wormer
* @copyright 2015-2016 Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module remark:parse
* @fileoverview Markdown parser.
*/

'use strict';

/* eslint-env commonjs */

/* Dependencies. */
var unherit = require('unherit');
var Parser = require('./lib/parser.js');

/* Expose */
module.exports = exports = parse;
exports.Parser = Parser;

/**
* Attacher.
*
* @param {unified} processor - Unified processor.
*/
function parse(processor) {
processor.Parser = unherit(Parser);
processor.Parser = unherit(Parser);
}

/* Patch `Parser`. */
parse.Parser = Parser;

/* Expose */
module.exports = parse;
Loading

0 comments on commit 904aaee

Please sign in to comment.