Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dbc2820

Browse filesBrowse files
eslint + prettier - jshint
1 parent 585b71f commit dbc2820
Copy full SHA for dbc2820

File tree

Expand file treeCollapse file tree

5 files changed

+97
-85
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+97
-85
lines changed

‎.eslintrc

Copy file name to clipboard
+71-15Lines changed: 71 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,75 @@
11
{
2-
"extends": "./node_modules/fbjs-scripts/eslint/.eslintrc",
2+
"root": true,
3+
"parserOptions": {
4+
"ecmaVersion": 6,
5+
"sourceType": "module"
6+
},
7+
"extends": [
8+
"airbnb",
9+
"prettier",
10+
"prettier/react"
11+
],
12+
"plugins": [
13+
"react",
14+
"prettier"
15+
],
316
"rules": {
4-
// These are functional errors that could either be fixed or be locally disabled in specific
5-
// files
6-
"no-bitwise": 0,
7-
"constructor-super": 0,
8-
"no-this-before-super": 0,
9-
"no-self-compare": 0,
10-
"operator-assignment": 0,
11-
"consistent-return": 0,
12-
13-
// These are stylistic errors that could be easily fixed
14-
"semi": 0,
15-
"comma-dangle": 0,
16-
"space-before-function-paren": 0,
17-
"curly": 0,
17+
"no-empty": "warn",
18+
"no-shadow": "warn",
19+
"no-plusplus": "off",
20+
"no-param-reassign": "warn",
21+
"no-sequences": "warn",
22+
"no-useless-concat": "warn",
23+
"no-unused-expressions": "warn",
24+
"consistent-return": "warn",
25+
"no-underscore-dangle": "off",
26+
"no-nested-ternary": "off",
27+
"no-self-compare": "off",
28+
"no-use-before-define": "warn",
29+
"no-bitwise": "off",
30+
"no-lonely-if": "warn",
31+
"no-var": "warn",
32+
"no-else-return": "warn",
33+
"operator-assignment": "warn",
34+
"no-return-assign": "warn",
35+
"no-continue": "off",
36+
"class-methods-use-this": "off",
37+
"one-var": "warn",
38+
"vars-on-top": "warn",
39+
"default-case": "off",
40+
"array-callback-return": "off",
41+
"prefer-spread": "off",
42+
"prefer-template": "warn",
43+
"spaced-comment": "warn",
44+
"object-shorthand": "warn",
45+
"prefer-rest-params": "off",
46+
"no-prototype-builtins": "off",
47+
"no-cond-assign": "off",
48+
"no-multi-assign": "off",
49+
"no-unused-vars": "warn",
50+
"constructor-super": "warn",
51+
"block-scoped-var": "warn",
52+
"no-this-before-super": "warn",
53+
"react/sort-comp": "warn",
54+
"react/no-multi-comp": "off",
55+
"react/prop-types": "warn",
56+
"react/prefer-es6-class": "warn",
57+
"react/prefer-stateless-function": "warn",
58+
"react/no-array-index-key": "off",
59+
"react/self-closing-comp": "warn",
60+
"react/jsx-boolean-value": "warn",
61+
"react/jsx-filename-extension": "off",
62+
"import/no-unresolved": "warn",
63+
"import/no-mutable-exports": "warn",
64+
"import/newline-after-import": "warn",
65+
"import/prefer-default-export": "off",
66+
"import/no-extraneous-dependencies": "off",
67+
"jsx-a11y/no-static-element-interactions": "warn",
68+
"prettier/prettier": [
69+
"warn",
70+
{
71+
"singleQuote": true
72+
}
73+
]
1874
}
1975
}

‎Gruntfile.js

Copy file name to clipboardExpand all lines: Gruntfile.js
+2-28Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,13 @@ var stripCopyright = require('./resources/stripCopyright');
88

99
/**
1010
*
11-
* grunt lint Lint all source javascript
1211
* grunt clean Clean dist folder
1312
* grunt build Build dist javascript
14-
* grunt default Lint, Build then Test
13+
* grunt default Build then Test
1514
*
1615
*/
1716
module.exports = function(grunt) {
1817
grunt.initConfig({
19-
jshint: {
20-
options: {
21-
asi: true,
22-
curly: false,
23-
eqeqeq: true,
24-
esnext: true,
25-
expr: true,
26-
forin: true,
27-
freeze: false,
28-
immed: true,
29-
indent: 2,
30-
iterator: true,
31-
loopfunc: true,
32-
noarg: true,
33-
node: true,
34-
noempty: true,
35-
nonstandard: true,
36-
trailing: true,
37-
undef: true,
38-
unused: 'vars',
39-
},
40-
all: ['src/**/*.js']
41-
},
4218
clean: {
4319
build: ['dist/*']
4420
},
@@ -200,12 +176,10 @@ module.exports = function(grunt) {
200176
);
201177
});
202178

203-
grunt.loadNpmTasks('grunt-contrib-jshint');
204179
grunt.loadNpmTasks('grunt-contrib-copy');
205180
grunt.loadNpmTasks('grunt-contrib-clean');
206181
grunt.loadNpmTasks('grunt-release');
207182

208-
grunt.registerTask('lint', 'Lint all source javascript', ['jshint']);
209183
grunt.registerTask('build', 'Build distributed javascript', ['clean', 'bundle', 'copy', 'typedefs']);
210-
grunt.registerTask('default', 'Lint, build.', ['lint', 'build', 'stats']);
184+
grunt.registerTask('default', 'Build.', ['build', 'stats']);
211185
}

‎gulpfile.js

Copy file name to clipboardExpand all lines: gulpfile.js
+3-36Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ var gulp = require('gulp');
1010
var gutil = require('gulp-util');
1111
var header = require('gulp-header');
1212
var Immutable = require('./');
13-
var jshint = require('gulp-jshint');
1413
var less = require('gulp-less');
1514
var path = require('path');
1615
var React = require('react/addons');
@@ -19,7 +18,6 @@ var sequence = require('run-sequence');
1918
var size = require('gulp-size');
2019
var source = require('vinyl-source-stream');
2120
var sourcemaps = require('gulp-sourcemaps');
22-
var stylish = require('jshint-stylish');
2321
var through = require('through2');
2422
var uglify = require('gulp-uglify');
2523
var vm = require('vm');
@@ -69,37 +67,6 @@ gulp.task('typedefs', function() {
6967
fs.writeFileSync(writePath, contents);
7068
});
7169

72-
gulp.task('lint', function() {
73-
return gulp.src('./app/**/*.js')
74-
.pipe(reactTransform())
75-
.on('error', handleError)
76-
.pipe(jshint({
77-
asi: true,
78-
browser: true,
79-
curly: false,
80-
eqeqeq: true,
81-
eqnull: true,
82-
esnext: true,
83-
expr: true,
84-
forin: true,
85-
freeze: true,
86-
immed: true,
87-
indent: 2,
88-
iterator: true,
89-
newcap: false,
90-
noarg: true,
91-
node: true,
92-
noempty: true,
93-
nonstandard: true,
94-
trailing: true,
95-
undef: true,
96-
unused: 'vars',
97-
}))
98-
.pipe(jshint.reporter(stylish))
99-
.pipe(jshint.reporter('fail'))
100-
.on('error', handleError);
101-
});
102-
10370
gulp.task('js', gulpJS(''));
10471
gulp.task('js-docs', gulpJS('docs/'));
10572

@@ -199,7 +166,7 @@ gulp.task('build', function (done) {
199166
});
200167

201168
gulp.task('default', function (done) {
202-
sequence('clean', 'lint', 'build', done);
169+
sequence('clean', 'build', done);
203170
});
204171

205172
// watch files for changes and reload
@@ -224,14 +191,14 @@ gulp.task('dev', ['default'], function() {
224191
});
225192

226193
gulp.task('rebuild-js', function (done) {
227-
sequence('lint', 'js', ['pre-render'], function () {
194+
sequence('js', ['pre-render'], function () {
228195
browserSync.reload();
229196
done();
230197
});
231198
});
232199

233200
gulp.task('rebuild-js-docs', function (done) {
234-
sequence('lint', 'js-docs', ['pre-render-docs'], function () {
201+
sequence('js-docs', ['pre-render-docs'], function () {
235202
browserSync.reload();
236203
done();
237204
});

‎package.json

Copy file name to clipboardExpand all lines: package.json
+12-6Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
},
2222
"scripts": {
2323
"build": "grunt default && gulp default",
24-
"lint": "eslint src/ && grunt lint && gulp lint",
24+
"lint": "eslint \"{src,pages/src}/**/*.js\" --quiet",
25+
"lint:warn": "eslint \"{src,pages/src}/**/*.js\"",
26+
"format": "prettier --single-quote --write \"{src,pages/src}/**/*.js\"",
2527
"testonly": "./resources/jest",
26-
"test": "npm run build && npm run lint && npm run testonly && npm run type-check",
28+
"test": "npm run lint && npm run build && npm run testonly && npm run type-check",
2729
"type-check": "cd type-definitions/tests && flow check",
2830
"perf": "node ./resources/bench.js",
2931
"start": "gulp dev",
@@ -51,7 +53,13 @@
5153
"colors": "1.1.2",
5254
"del": "2.2.2",
5355
"es6-transpiler": "0.7.18",
54-
"eslint": "^1.10.3",
56+
"eslint": "^3.15.0",
57+
"eslint-config-airbnb": "14.1.0",
58+
"eslint-config-prettier": "1.5.0",
59+
"eslint-plugin-import": "^2.2.0",
60+
"eslint-plugin-jsx-a11y": "^4.0.0",
61+
"eslint-plugin-prettier": "2.0.1",
62+
"eslint-plugin-react": "^6.9.0",
5563
"estraverse": "1.9.3",
5664
"express": "^4.13.4",
5765
"fbjs-scripts": "^0.5.0",
@@ -60,24 +68,22 @@
6068
"grunt-cli": "1.2.0",
6169
"grunt-contrib-clean": "1.0.0",
6270
"grunt-contrib-copy": "1.0.0",
63-
"grunt-contrib-jshint": "1.1.0",
6471
"grunt-release": "0.14.0",
6572
"gulp": "3.9.1",
6673
"gulp-concat": "2.6.1",
6774
"gulp-filter": "5.0.0",
6875
"gulp-header": "1.8.8",
69-
"gulp-jshint": "2.0.4",
7076
"gulp-less": "3.3.0",
7177
"gulp-size": "2.1.0",
7278
"gulp-sourcemaps": "1.6.0",
7379
"gulp-uglify": "2.0.1",
7480
"gulp-util": "3.0.8",
7581
"jasmine-check": "^0.1.2",
7682
"jest": "^17.0.3",
77-
"jshint-stylish": "^0.4.0",
7883
"magic-string": "0.10.2",
7984
"marked": "0.3.6",
8085
"microtime": "^2.0.0",
86+
"prettier": "0.21.0",
8187
"react": "^0.12.0",
8288
"react-router": "^0.11.2",
8389
"react-tools": "^0.12.0",

‎pages/src/.eslintrc

Copy file name to clipboard
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"env": {
3+
"browser": true
4+
},
5+
"parserOptions": {
6+
"ecmaVersion": 6,
7+
"sourceType": "script"
8+
}
9+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.