Created
November 15, 2016 13:59
-
-
Save JoshTheWanderer/6a6fbe3bb164e977bf6debb777d09b75 to your computer and use it in GitHub Desktop.
A rough linting boilerplate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"extends": "airbnb", | |
"plugins": [ | |
"react" | |
], | |
"env": { | |
"es6": true | |
}, | |
"parserOptions": { | |
"ecmaVersion": 6, | |
"ecmaFeatures": { | |
"experimentalObjectRestSpread": true | |
} | |
}, | |
"rules": { | |
"arrow-body-style": [2, "always"], | |
"react/prefer-stateless-function": 0 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files: | |
include: '**/*.s+(a|c)ss' | |
options: | |
formatter: stylish | |
merge-default-rules: true | |
rules: | |
class-name-format: | |
- 1 | |
- convention: hyphenatedbem | |
id-name-format: | |
- 1 | |
- convention: hyphenatedbem | |
nesting-depth: | |
- 1 | |
- max-depth: 4 | |
placeholder-name-format: | |
- 1 | |
- convention: hyphenatedbem | |
property-sort-order: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from 'path'; | |
const config = {}; | |
config.scssLint = { | |
src: [ | |
'/styles/**/*.scss', | |
], | |
options: { | |
config: path.join(__dirname, '../.scss-lint.yml'), | |
}, | |
}; | |
config.eslint = { | |
src: ['/scripts/**/*.js', 'gulpfile.babel.js/**/*.js'], | |
}; | |
config.phpcs = { | |
src: [ | |
'app/**/*.php', | |
'bootstrap/**/*.php', | |
'routes/**/*.php', | |
'tests/**/*.php', | |
'!bootstrap/cache/**/*.php', | |
], | |
options: { | |
bin: './vendor/bin/phpcs', | |
standard: 'PSR2', | |
warningSeverity: 0, | |
}, | |
}; | |
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gulp from 'gulp'; | |
import eslint from 'gulp-eslint'; | |
import config from '../config'; | |
gulp.task('eslint', () => { | |
return gulp.src(config.eslint.src) | |
.pipe(eslint()) | |
.pipe(eslint.format()) | |
.pipe(eslint.failAfterError()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gulp from 'gulp'; | |
import runSequence from 'run-sequence'; | |
import './tasks/eslint'; | |
import './tasks/sass-lint'; | |
import './tasks/php-cs'; | |
gulp.task('lint', (done) => { | |
runSequence('eslint', 'scss-lint', 'php-cs', () => { | |
done(); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "linting-base", | |
"version": "1.0.0", | |
"private": true, | |
"author": "Etch Software Ltd", | |
"license": "ISC", | |
"scripts": { | |
"lint": "gulp lint", | |
"precommit": "yarn run lint", | |
}, | |
"devDependencies": { | |
"eslint": "^3.8.1", | |
"eslint-config-airbnb": "^12.0.0", | |
"eslint-plugin-import": "^1.16.0", | |
"eslint-plugin-jsx-a11y": "^2.2.3", | |
"eslint-plugin-react": "^6.4.1", | |
"gulp": "^3.9.1", | |
"gulp-eslint": "^3.0.1", | |
"gulp-phpcs": "^1.1.1", | |
"gulp-sass-lint": "^1.3.1", | |
"husky": "^0.11.7", | |
"yarn": "^0.16.1", | |
"run-sequence": "^1.2.2" | |
}, | |
"engines": { | |
"node": ">=6.3.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gulp from 'gulp'; | |
import phpcs from 'gulp-phpcs'; | |
import config from '../config'; | |
gulp.task('php-cs', () => { | |
return gulp.src(config.phpcs.src) | |
.pipe(phpcs(config.phpcs.options)) | |
.pipe(phpcs.reporter('log')) | |
.pipe(phpcs.reporter('fail')); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gulp from 'gulp'; | |
import scssLint from 'gulp-scss-lint'; | |
import config from '../config'; | |
gulp.task('scss-lint', () => { | |
return gulp.src(config.scssLint.src) | |
.pipe(scssLint(config.scssLint.options)) | |
.pipe(scssLint.failReporter('E')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment