Skip to content
This repository was archived by the owner on Jan 25, 2024. It is now read-only.

Commit c947ede

Browse files
ldeavilajamsea
authored andcommittedJun 20, 2017
Add prettier (nfl#295)
- Add prettier - Apply prettier formatting to the project
1 parent 8981671 commit c947ede

9 files changed

+2672
-1724
lines changed
 

‎.eslintrc

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "nfl",
2+
"extends": ["nfl", "prettier"],
33
"env": {
44
"browser": true,
55
"mocha": true,
@@ -8,5 +8,22 @@
88
"globals": {
99
"expect": false,
1010
"sinon": false
11+
},
12+
"plugins": [
13+
"prettier"
14+
],
15+
"rules": {
16+
"prettier/prettier": ["error", {
17+
"printWidth": 80,
18+
"tabWidth": 4,
19+
"singleQuote": false,
20+
"trailingComma": "none",
21+
"bracketSpacing": false,
22+
"semi": true,
23+
"useTabs": false,
24+
"parser": "babylon",
25+
"jsxBracketSameLine": false
26+
}
27+
]
1128
}
1229
}

‎karma.config.js

+18-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Karma configuration
22

3-
module.exports = function (config) {
3+
module.exports = function(config) {
44
function normalizationBrowserName(browser) {
55
return browser.toLowerCase().split(/[ /-]/)[0];
66
}
@@ -20,14 +20,9 @@ module.exports = function (config) {
2020
},
2121

2222
// frameworks to use
23-
frameworks: [
24-
"chai-sinon",
25-
"mocha"
26-
],
23+
frameworks: ["chai-sinon", "mocha"],
2724

28-
files: [
29-
"./test/test.js"
30-
],
25+
files: ["./test/test.js"],
3126

3227
preprocessors: {
3328
// add webpack as preprocessor
@@ -37,21 +32,25 @@ module.exports = function (config) {
3732
coverageReporter: {
3833
dir: "coverage/json",
3934
includeAllSources: true,
40-
reporters: [{
41-
type: "json",
42-
subdir: normalizationBrowserName
43-
}]
35+
reporters: [
36+
{
37+
type: "json",
38+
subdir: normalizationBrowserName
39+
}
40+
]
4441
},
4542

4643
webpack: {
4744
devtool: "inline-source-map",
4845
module: {
49-
rules: [{
50-
test: /\.js$/,
51-
// exclude this dirs from coverage
52-
exclude: [/node_modules/],
53-
loader: "babel-loader"
54-
}]
46+
rules: [
47+
{
48+
test: /\.js$/,
49+
// exclude this dirs from coverage
50+
exclude: [/node_modules/],
51+
loader: "babel-loader"
52+
}
53+
]
5554
},
5655
watch: true
5756
},
@@ -62,10 +61,7 @@ module.exports = function (config) {
6261

6362
// test results reporter to use
6463
// possible values: "dots", "progress", "junit", "growl", "coverage"
65-
reporters: [
66-
"coverage",
67-
"spec"
68-
],
64+
reporters: ["coverage", "spec"],
6965

7066
// web server port
7167
port: 9876,

‎package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@
5555
"cz-conventional-changelog": "^2.0.0",
5656
"eslint": "^3.18.0",
5757
"eslint-config-nfl": "^11.1.0",
58+
"eslint-config-prettier": "^2.2.0",
5859
"eslint-plugin-import": "^2.2.0",
5960
"eslint-plugin-jsx-a11y": "^4.0.0",
6061
"eslint-plugin-mocha": "^4.9.0",
62+
"eslint-plugin-prettier": "^2.1.2",
6163
"eslint-plugin-react": "^6.10.2",
6264
"istanbul": "^0.4.5",
6365
"karma": "^1.5.0",
@@ -76,6 +78,7 @@
7678
"karma-webpack": "^2.0.3",
7779
"mocha": "^3.2.0",
7880
"phantomjs-prebuilt": "^2.1.14",
81+
"prettier": "^1.4.4",
7982
"react": "^15.x",
8083
"react-dom": "^15.x",
8184
"rimraf": "^2.6.1",
@@ -86,7 +89,7 @@
8689
"scripts": {
8790
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
8891
"clean": "rimraf lib coverage es",
89-
"lint": "eslint --ignore-path .gitignore -- .",
92+
"lint": "eslint --ignore-path .gitignore --fix -- .",
9093
"test": "cross-env BABEL_ENV=test karma start karma.config.js",
9194
"posttest": "istanbul report lcov text",
9295
"pretest": "npm run clean && npm run lint",

0 commit comments

Comments
 (0)
This repository has been archived.