├── .gitignore ├── index.mk ├── package.json ├── Readme.md └── config.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /index.mk: -------------------------------------------------------------------------------- 1 | 2 | SRC ?= *.js 3 | DIR ?= $(dir $(lastword $(MAKEFILE_LIST))) 4 | LINT_CONFIG ?= $(DIR)/config.json 5 | LINT := $(DIR)/node_modules/.bin/eslint 6 | 7 | lint: 8 | @$(LINT) --reset --config $(LINT_CONFIG) $(SRC) 9 | 10 | .PHONY: lint 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "make-lint", 3 | "version": "1.0.1", 4 | "repository": "visionmedia/make-lint", 5 | "description": "eslint make target", 6 | "keywords": [ 7 | "make", 8 | "lint", 9 | "makefile", 10 | "eslint", 11 | "linting" 12 | ], 13 | "dependencies": { 14 | "eslint": "^0.5.1" 15 | }, 16 | "devDependencies": { 17 | "mocha": "*", 18 | "should": "*" 19 | }, 20 | "license": "MIT", 21 | "main": "config.json" 22 | } 23 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | 2 | # make-lint 3 | 4 | ESLint `lint` target for Make with sane defaults. 5 | 6 | ![](http://indul.ccio.co/YE/Z8/U6/285767538825924428N2LbBDGkc.jpg) 7 | 8 | ## Installation 9 | 10 | ``` 11 | $ npm install --save-dev make-lint 12 | ``` 13 | 14 | ## Example 15 | 16 | Include, defaulting to `*.js`: 17 | 18 | ```Makefile 19 | include node_modules/make-lint/index.mk 20 | ``` 21 | 22 | Specify the source: 23 | 24 | ```Makefile 25 | SRC = lib/*.js 26 | include node_modules/make-lint/index.mk 27 | ``` 28 | 29 | Specify configuration: 30 | 31 | ```Makefile 32 | LINT_CONFIG = myconfig.json 33 | ``` 34 | 35 | Typically also: 36 | 37 | ``` 38 | test: lint 39 | # test stuff here 40 | ``` 41 | 42 | # License 43 | 44 | MIT -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true 4 | }, 5 | "rules": { 6 | // warnings 7 | "no-debugger": 1, 8 | "no-empty": 1, 9 | "no-invalid-regexp": 1, 10 | "radix": 1, 11 | "no-warning-comments": 1, 12 | "no-unused-expressions": 1, 13 | "no-native-reassign": 1, 14 | "no-fallthrough": 1, 15 | 16 | // errors 17 | "no-undef": 2, 18 | "no-dupe-keys": 2, 19 | "no-empty-class": 2, 20 | "no-self-compare": 2, 21 | "valid-typeof": 2, 22 | "no-unused-vars": 2, 23 | "handle-callback-err": 2, 24 | "no-shadow-restricted-names": 2, 25 | 26 | // stylistic errors 27 | "new-cap": 2, 28 | "no-spaced-func": 2, 29 | "no-space-before-semi": 2, 30 | "space-unary-word-ops": 2 31 | } 32 | } --------------------------------------------------------------------------------