Skip to content

Commit

Permalink
Add prettier (#295)
Browse files Browse the repository at this point in the history
- Add prettier
- Apply prettier formatting to the project
  • Loading branch information
ldeavila authored and jamsea committed Jun 20, 2017
1 parent 8981671 commit c947ede
Show file tree
Hide file tree
Showing 9 changed files with 2,672 additions and 1,724 deletions.
19 changes: 18 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "nfl",
"extends": ["nfl", "prettier"],
"env": {
"browser": true,
"mocha": true,
Expand All @@ -8,5 +8,22 @@
"globals": {
"expect": false,
"sinon": false
},
"plugins": [
"prettier"
],
"rules": {
"prettier/prettier": ["error", {
"printWidth": 80,
"tabWidth": 4,
"singleQuote": false,
"trailingComma": "none",
"bracketSpacing": false,
"semi": true,
"useTabs": false,
"parser": "babylon",
"jsxBracketSameLine": false
}
]
}
}
40 changes: 18 additions & 22 deletions karma.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Karma configuration

module.exports = function (config) {
module.exports = function(config) {
function normalizationBrowserName(browser) {
return browser.toLowerCase().split(/[ /-]/)[0];
}
Expand All @@ -20,14 +20,9 @@ module.exports = function (config) {
},

// frameworks to use
frameworks: [
"chai-sinon",
"mocha"
],
frameworks: ["chai-sinon", "mocha"],

files: [
"./test/test.js"
],
files: ["./test/test.js"],

preprocessors: {
// add webpack as preprocessor
Expand All @@ -37,21 +32,25 @@ module.exports = function (config) {
coverageReporter: {
dir: "coverage/json",
includeAllSources: true,
reporters: [{
type: "json",
subdir: normalizationBrowserName
}]
reporters: [
{
type: "json",
subdir: normalizationBrowserName
}
]
},

webpack: {
devtool: "inline-source-map",
module: {
rules: [{
test: /\.js$/,
// exclude this dirs from coverage
exclude: [/node_modules/],
loader: "babel-loader"
}]
rules: [
{
test: /\.js$/,
// exclude this dirs from coverage
exclude: [/node_modules/],
loader: "babel-loader"
}
]
},
watch: true
},
Expand All @@ -62,10 +61,7 @@ module.exports = function (config) {

// test results reporter to use
// possible values: "dots", "progress", "junit", "growl", "coverage"
reporters: [
"coverage",
"spec"
],
reporters: ["coverage", "spec"],

// web server port
port: 9876,
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@
"cz-conventional-changelog": "^2.0.0",
"eslint": "^3.18.0",
"eslint-config-nfl": "^11.1.0",
"eslint-config-prettier": "^2.2.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-mocha": "^4.9.0",
"eslint-plugin-prettier": "^2.1.2",
"eslint-plugin-react": "^6.10.2",
"istanbul": "^0.4.5",
"karma": "^1.5.0",
Expand All @@ -76,6 +78,7 @@
"karma-webpack": "^2.0.3",
"mocha": "^3.2.0",
"phantomjs-prebuilt": "^2.1.14",
"prettier": "^1.4.4",
"react": "^15.x",
"react-dom": "^15.x",
"rimraf": "^2.6.1",
Expand All @@ -86,7 +89,7 @@
"scripts": {
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"clean": "rimraf lib coverage es",
"lint": "eslint --ignore-path .gitignore -- .",
"lint": "eslint --ignore-path .gitignore --fix -- .",
"test": "cross-env BABEL_ENV=test karma start karma.config.js",
"posttest": "istanbul report lcov text",
"pretest": "npm run clean && npm run lint",
Expand Down
Loading

0 comments on commit c947ede

Please sign in to comment.