Code Monkey home page Code Monkey logo

awesome-lint's Introduction


awesome-lint


Linter for Awesome lists

Build Status

Intended to make it easier to create and maintain Awesome lists.

Includes a bunch of general Markdown rules and some Awesome specific rules.

CLI

Install

$ npm install --global awesome-lint

Usage

❯ awesome-lint

  readme.md:1:1
  ✖    1:1  Missing Awesome badge after the main heading      awesome-badge
  ✖   12:1  Marker style should be -                          unordered-list-marker-style
  ✖  199:3  Remove trailing slash (https://sindresorhus.com)  trailing-slash

  3 errors

Special comments

You can enable, disable, and ignore rules using special comments. This is based on remark-message-control.

By default, all rules are turned on. For example, 4 errors (2 of no-dead-urls and 2 of awesome-list-item) will be generated for following code snippets.

- [foo](https://foo.com) - an invalid description.
- [foo](https://foo.com) - invalid description.
disable

The disable keyword turns off all messages of the given rule identifiers. If no identifiers are specified, all messages are turned off.

Don't leave spaces after the last rule identifier.

For example, only the 2 no-dead-urls errors are left:

<!--lint disable awesome-list-item-->
- [foo](https://foo.com) - an invalid description.
- [foo](https://foo.com) - invalid description.
enable

The enable keyword turns on all messages of the given rule identifiers. If no identifiers are specified, all messages are turned on.

For example, only the second line reports a awesome-list-item rule violation:

<!--lint disable awesome-list-item-->
- [foo](https://foo.com) - an invalid description.
<!--lint enable awesome-list-item-->
- [foo](https://foo.com) - invalid description.
ignore

The ignore keyword turns off all messages of the given rule identifiers occurring in the following node. If no identifiers are specified, all messages are turned ignored. After the end of the following node, messages are turned on again. This is the main difference with disable.

For example, to turn off certain messages for the next node:

<!--lint ignore awesome-list-item-->
- [foo](https://foo.com) - an invalid description.

List items share the same parent node. So let's create a new list.

- [foo](https://foo.com) - invalid description.

Tip

Add it as a test script in package.json and activate Travis CI to lint on new commits and pull requests.

Note: Travis CI only clones repositories to a maximum of 50 commits by default, which may result in a false positive of awesome/git-repo-age, and so you should set depth to false in .travis.yml if needed.

Note: Avoid rate limit problems on Travis CI by defining a GitHub personal access token in an environment variable named github_token. See defining variables in repository settings.

package.json
{
	"scripts": {
		"test": "awesome-lint"
	},
	"devDependencies": {
		"awesome-lint": "*"
	}
}
.travis.yml
language: node_js
node_js:
  - 'node'
# git:
#   depth: false

API

Install

$ npm install awesome-lint

Usage

const awesomeLint = require('awesome-lint');

awesomeLint.report();

Docs

awesomeLint()

Returns a Promise for a list of VFile objects.

awesomeLint.report()

Show the lint output. This can be custom reported by setting options.reporter=<function> and passing in options as a parameter.

Maintainers

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.