Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit b34b49b

Browse files
feat(templates): Add config files (#39)
Closes #34
1 parent f860c2c commit b34b49b

File tree

15 files changed

+206
-11
lines changed

15 files changed

+206
-11
lines changed

packages/tasks/common/build.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ module.exports = function build(config) {
2525
// Use `.babelrc.template` as name to not trigger babel
2626
// when requiring the file `.template.js` in end-to-end tests
2727
// and rename it `.babelrc` afterwards
28-
[/\.babelrc.template$/, '.babelrc'],
28+
['.babelrc.template', '.babelrc'],
29+
['.eslintrc.js.hbs', '.eslintrc.js'],
2930
])
3031
)
3132
.use(inPlace())

scripts/__snapshots__/e2e-templates.test.js.snap

Lines changed: 120 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,30 @@ Array [
945945
]
946946
`;
947947
948+
exports[`Templates InstantSearch.js File content: .editorconfig 1`] = `
949+
"root = true
950+
951+
[*]
952+
charset = utf-8
953+
indent_style = space
954+
indent_size = 2
955+
end_of_line = lf
956+
insert_final_newline = true
957+
trim_trailing_whitespace = true"
958+
`;
959+
960+
exports[`Templates InstantSearch.js File content: .eslintignore 1`] = `
961+
"/node_modules
962+
/dist
963+
/.cache"
964+
`;
965+
966+
exports[`Templates InstantSearch.js File content: .eslintrc.js 1`] = `
967+
"module.exports = {
968+
extends: 'algolia',
969+
};"
970+
`;
971+
948972
exports[`Templates InstantSearch.js File content: .gitignore 1`] = `
949973
"# See https://help.github.com/ignore-files/ for more about ignoring files.
950974
@@ -970,6 +994,14 @@ yarn-debug.log*
970994
yarn-error.log*"
971995
`;
972996
997+
exports[`Templates InstantSearch.js File content: .prettierrc 1`] = `
998+
"{
999+
\\"singleQuote\\": true,
1000+
\\"proseWrap\\": \\"never\\",
1001+
\\"trailingComma\\": \\"es5\\"
1002+
}"
1003+
`;
1004+
9731005
exports[`Templates InstantSearch.js File content: README.md 1`] = `
9741006
"# instantsearch.js-app
9751007
@@ -1073,10 +1105,19 @@ exports[`Templates InstantSearch.js File content: package.json 1`] = `
10731105
\\"private\\": true,
10741106
\\"scripts\\": {
10751107
\\"start\\": \\"parcel index.html --port 3000\\",
1076-
\\"build\\": \\"parcel build index.html\\"
1108+
\\"build\\": \\"parcel build index.html\\",
1109+
\\"lint\\": \\"eslint .\\",
1110+
\\"lint:fix\\": \\"npm run lint -- --fix\\"
10771111
},
10781112
\\"devDependencies\\": {
1079-
\\"parcel-bundler\\": \\"^1.8.1\\"
1113+
\\"babel-eslint\\": \\"^8.2.3\\",
1114+
\\"eslint\\": \\"^4.19.1\\",
1115+
\\"eslint-config-algolia\\": \\"^13.1.0\\",
1116+
\\"eslint-config-prettier\\": \\"^2.9.0\\",
1117+
\\"eslint-plugin-import\\": \\"^2.12.0\\",
1118+
\\"eslint-plugin-prettier\\": \\"^2.6.0\\",
1119+
\\"parcel-bundler\\": \\"^1.8.1\\",
1120+
\\"prettier\\": \\"^1.13.4\\"
10801121
}
10811122
}"
10821123
`;
@@ -1202,7 +1243,6 @@ search.addWidget(
12021243
})
12031244
);
12041245
1205-
12061246
search.addWidget(
12071247
instantsearch.widgets.pagination({
12081248
container: '#pagination',
@@ -1227,7 +1267,11 @@ body {
12271267
12281268
exports[`Templates InstantSearch.js Folder structure: contains the right files 1`] = `
12291269
Array [
1270+
".editorconfig",
1271+
".eslintignore",
1272+
".eslintrc.js",
12301273
".gitignore",
1274+
".prettierrc",
12311275
"README.md",
12321276
"favicon.png",
12331277
"index.html",
@@ -1239,6 +1283,24 @@ Array [
12391283
]
12401284
`;
12411285
1286+
exports[`Templates React InstantSearch File content: .editorconfig 1`] = `
1287+
"root = true
1288+
1289+
[*]
1290+
charset = utf-8
1291+
indent_style = space
1292+
indent_size = 2
1293+
end_of_line = lf
1294+
insert_final_newline = true
1295+
trim_trailing_whitespace = true"
1296+
`;
1297+
1298+
exports[`Templates React InstantSearch File content: .eslintrc.js 1`] = `
1299+
"module.exports = {
1300+
extends: 'algolia/react',
1301+
};"
1302+
`;
1303+
12421304
exports[`Templates React InstantSearch File content: .gitignore 1`] = `
12431305
"# See https://help.github.com/ignore-files/ for more about ignoring files.
12441306
@@ -1263,6 +1325,14 @@ yarn-debug.log*
12631325
yarn-error.log*"
12641326
`;
12651327
1328+
exports[`Templates React InstantSearch File content: .prettierrc 1`] = `
1329+
"{
1330+
\\"singleQuote\\": true,
1331+
\\"proseWrap\\": \\"never\\",
1332+
\\"trailingComma\\": \\"es5\\"
1333+
}"
1334+
`;
1335+
12661336
exports[`Templates React InstantSearch File content: README.md 1`] = `
12671337
"# react-instantsearch-app
12681338
@@ -1292,7 +1362,9 @@ exports[`Templates React InstantSearch File content: package.json 1`] = `
12921362
\\"private\\": true,
12931363
\\"scripts\\": {
12941364
\\"start\\": \\"react-scripts start\\",
1295-
\\"build\\": \\"react-scripts build\\"
1365+
\\"build\\": \\"react-scripts build\\",
1366+
\\"lint\\": \\"eslint .\\",
1367+
\\"lint:fix\\": \\"npm run lint -- --fix\\"
12961368
},
12971369
\\"dependencies\\": {
12981370
\\"react\\": \\"^16.3.2\\",
@@ -1301,6 +1373,13 @@ exports[`Templates React InstantSearch File content: package.json 1`] = `
13011373
\\"react-scripts\\": \\"1.1.4\\"
13021374
},
13031375
\\"devDependencies\\": {
1376+
\\"eslint\\": \\"^4.19.1\\",
1377+
\\"eslint-config-algolia\\": \\"^13.1.0\\",
1378+
\\"eslint-config-prettier\\": \\"^2.9.0\\",
1379+
\\"eslint-plugin-import\\": \\"^2.12.0\\",
1380+
\\"eslint-plugin-prettier\\": \\"^2.6.0\\",
1381+
\\"eslint-plugin-react\\": \\"^7.9.1\\",
1382+
\\"prettier\\": \\"^1.13.4\\",
13041383
\\"prop-types\\": \\"^15.6.1\\"
13051384
}
13061385
}"
@@ -1515,7 +1594,10 @@ ReactDOM.render(<App />, document.getElementById('root'));"
15151594
15161595
exports[`Templates React InstantSearch Folder structure: contains the right files 1`] = `
15171596
Array [
1597+
".editorconfig",
1598+
".eslintrc.js",
15181599
".gitignore",
1600+
".prettierrc",
15191601
"README.md",
15201602
"package.json",
15211603
"public/favicon.png",
@@ -1537,6 +1619,27 @@ exports[`Templates Vue InstantSearch File content: .babelrc 1`] = `
15371619
}"
15381620
`;
15391621
1622+
exports[`Templates Vue InstantSearch File content: .editorconfig 1`] = `
1623+
"root = true
1624+
1625+
[*]
1626+
charset = utf-8
1627+
indent_style = space
1628+
indent_size = 2
1629+
end_of_line = lf
1630+
insert_final_newline = true
1631+
trim_trailing_whitespace = true"
1632+
`;
1633+
1634+
exports[`Templates Vue InstantSearch File content: .eslintrc.js 1`] = `
1635+
"module.exports = {
1636+
extends: 'algolia/vue',
1637+
rules: {
1638+
'import/no-commonjs': 'off',
1639+
},
1640+
};"
1641+
`;
1642+
15401643
exports[`Templates Vue InstantSearch File content: .gitignore 1`] = `
15411644
"node_modules/
15421645
npm-debug.log
@@ -1626,20 +1729,30 @@ exports[`Templates Vue InstantSearch File content: package.json 1`] = `
16261729
\\"private\\": true,
16271730
\\"scripts\\": {
16281731
\\"start\\": \\"cross-env NODE_ENV=development webpack-dev-server --port 3000 --hot\\",
1629-
\\"build\\": \\"cross-env NODE_ENV=production webpack --progress --hide-modules\\"
1732+
\\"build\\": \\"cross-env NODE_ENV=production webpack --progress --hide-modules\\",
1733+
\\"lint\\": \\"eslint --ext .js,.vue .\\",
1734+
\\"lint:fix\\": \\"npm run lint -- --fix\\"
16301735
},
16311736
\\"dependencies\\": {
16321737
\\"vue\\": \\"^2.5.16\\",
16331738
\\"vue-instantsearch\\": \\"^1.0.0\\"
16341739
},
16351740
\\"devDependencies\\": {
16361741
\\"babel-core\\": \\"6.26.0\\",
1742+
\\"babel-eslint\\": \\"^8.2.3\\",
16371743
\\"babel-loader\\": \\"7.1.4\\",
16381744
\\"babel-preset-env\\": \\"1.6.1\\",
16391745
\\"babel-preset-stage-3\\": \\"6.24.1\\",
16401746
\\"cross-env\\": \\"5.1.4\\",
16411747
\\"css-loader\\": \\"0.28.11\\",
1748+
\\"eslint\\": \\"^4.19.1\\",
1749+
\\"eslint-config-algolia\\": \\"^13.1.0\\",
1750+
\\"eslint-config-prettier\\": \\"^2.9.0\\",
1751+
\\"eslint-plugin-html\\": \\"^4.0.3\\",
1752+
\\"eslint-plugin-import\\": \\"^2.12.0\\",
1753+
\\"eslint-plugin-prettier\\": \\"^2.6.0\\",
16421754
\\"file-loader\\": \\"1.1.11\\",
1755+
\\"prettier\\": \\"^1.13.4\\",
16431756
\\"vue-loader\\": \\"14.2.2\\",
16441757
\\"vue-template-compiler\\": \\"2.5.16\\",
16451758
\\"webpack\\": \\"3.11.0\\",
@@ -1888,6 +2001,8 @@ if (process.env.NODE_ENV === 'production') {
18882001
exports[`Templates Vue InstantSearch Folder structure: contains the right files 1`] = `
18892002
Array [
18902003
".babelrc",
2004+
".editorconfig",
2005+
".eslintrc.js",
18912006
".gitignore",
18922007
"README.md",
18932008
"favicon.png",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/node_modules
2+
/dist
3+
/.cache
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: 'algolia',
3+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"proseWrap": "never",
4+
"trailingComma": "es5"
5+
}

templates/InstantSearch.js/package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@
44
"private": true,
55
"scripts": {
66
"start": "parcel index.html --port 3000",
7-
"build": "parcel build index.html"
7+
"build": "parcel build index.html",
8+
"lint": "eslint .",
9+
"lint:fix": "npm run lint -- --fix"
810
},
911
"devDependencies": {
10-
"parcel-bundler": "^1.8.1"
12+
"babel-eslint": "^8.2.3",
13+
"eslint": "^4.19.1",
14+
"eslint-config-algolia": "^13.1.0",
15+
"eslint-config-prettier": "^2.9.0",
16+
"eslint-plugin-import": "^2.12.0",
17+
"eslint-plugin-prettier": "^2.6.0",
18+
"parcel-bundler": "^1.8.1",
19+
"prettier": "^1.13.4"
1120
}
1221
}

templates/InstantSearch.js/src/app.js.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ search.addWidget(
3939
);
4040

4141
{{/each}}
42-
4342
search.addWidget(
4443
instantsearch.widgets.pagination({
4544
container: '#pagination',
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: 'algolia/react',
3+
};

0 commit comments

Comments
 (0)