Skip to content

Commit d71524d

Browse files
MichaelDeBoeyNoviny
authored andcommitted
Update Prettier + add pre-commit hook (#57)
* Update Prettier config * Update Prettier * Run Prettier on whole codebase * Add pre-commit hook
1 parent 91af712 commit d71524d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+957
-494
lines changed

.all-contributorsrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@
8888
"avatar_url": "https://avatars3.githubusercontent.com/u/6643991?v=4",
8989
"profile": "https://michaeldeboey.be",
9090
"contributions": [
91-
"maintenance"
91+
"maintenance",
92+
"tool"
9293
]
9394
}
9495
],

.changeset/README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,53 @@
11
# Changesets
22

3-
Hello and welcome! This folder has been automatically generated by `@atlaskit/build-releases`, a build tool that works with `bolt` to help you release components from a mono-repository. You can find the full documentation for it [here](https://www.npmjs.com/package/@atlaskit/build-releases)
3+
Hello and welcome! This folder has been automatically generated by
4+
`@atlaskit/build-releases`, a build tool that works with `bolt` to help you
5+
release components from a mono-repository. You can find the full documentation
6+
for it [here](https://www.npmjs.com/package/@atlaskit/build-releases)
47

5-
To help you get started though, here are some things you should know about this folder:
8+
To help you get started though, here are some things you should know about this
9+
folder:
610

711
## Changesets are automatically generated
812

9-
Changesets are generated by the `build-releases changeset` command, though it may have been given a new name within your repository. As long as you are following a changeset release flow, you shouldn't have any problems.
13+
Changesets are generated by the `build-releases changeset` command, though it
14+
may have been given a new name within your repository. As long as you are
15+
following a changeset release flow, you shouldn't have any problems.
1016

1117
## Each changeset is its own folder
1218

13-
We use hashes by default for these folder names to avoid collisions when generating them, but there's no harm that will come from renaming them.
19+
We use hashes by default for these folder names to avoid collisions when
20+
generating them, but there's no harm that will come from renaming them.
1421

1522
## Changesets are automatically removed
1623

17-
When `build-releases version` or equivalent command is run, all the changeset folders are removed. This is so we only ever use a changeset once. This makes this a very bad place to store any other information.
24+
When `build-releases version` or equivalent command is run, all the changeset
25+
folders are removed. This is so we only ever use a changeset once. This makes
26+
this a very bad place to store any other information.
1827

1928
## Changesets come in two parts
2029

2130
You should treat these parts quite differently:
2231

23-
- `changes.md` is a file you should feel free to edit as much as you want. It will be prepended to your changelog when you next run your version command.
24-
- `changes.json` is a file that includes information about releases, what should be versioned by the version command. We strongly recommend against editing this directly, as you may make a new changeset that puts your bolt repository into an invalid state.
32+
- `changes.md` is a file you should feel free to edit as much as you want. It
33+
will be prepended to your changelog when you next run your version command.
34+
- `changes.json` is a file that includes information about releases, what should
35+
be versioned by the version command. We strongly recommend against editing
36+
this directly, as you may make a new changeset that puts your bolt repository
37+
into an invalid state.
2538

2639
## I want to edit the information in a `changes.json` - how do I do it safely?
2740

28-
The best option is to make a new changeset using the changeset command, copy over the `changes.md`, then delete the old changeset.
41+
The best option is to make a new changeset using the changeset command, copy
42+
over the `changes.md`, then delete the old changeset.
2943

3044
## Can I rename the folder for my changeset?
3145

32-
Absolutely! We need unique hashes to make changesets play nicely with git, but changing your folder from our hash to your own name isn't going to cause any problems.
46+
Absolutely! We need unique hashes to make changesets play nicely with git, but
47+
changing your folder from our hash to your own name isn't going to cause any
48+
problems.
3349

3450
## Can I manually delete changesets?
3551

36-
You can, but you should be aware this will remove the intent to release communicated by the changeset, and should be done with caution.
52+
You can, but you should be aware this will remove the intent to release
53+
communicated by the changeset, and should be done with caution.

.changeset/config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const getReleaseLine = async (changeset, versionType) => {
3535
.join('\n');
3636

3737
return `- [${versionType}] [${changeset.commit}](${getLink(
38-
changeset.commit,
38+
changeset.commit
3939
)}):\n${indentedSummary}`;
4040
};
4141

@@ -54,12 +54,12 @@ const getDependencyReleaseLine = async (changesets, dependenciesUpdated) => {
5454
const changesetLinks = changesets.map(
5555
changeset =>
5656
`- Updated dependencies [${changeset.commit}](${getLink(
57-
changeset.commit,
58-
)}):`,
57+
changeset.commit
58+
)}):`
5959
);
6060

6161
const updatedDepenenciesList = dependenciesUpdated.map(
62-
dependency => ` - ${dependency.name}@${dependency.version}`,
62+
dependency => ` - ${dependency.name}@${dependency.version}`
6363
);
6464

6565
return [...changesetLinks, ...updatedDepenenciesList].join('\n');

.huskyrc.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
hooks: {
3+
'pre-commit': 'pretty-quick --staged',
4+
},
5+
};

.prettierrc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
module.exports = {
2+
endOfLine: 'lf',
3+
proseWrap: 'always',
24
singleQuote: true,
3-
trailingComma: 'all',
5+
trailingComma: 'es5',
46
};

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ script:
88
- yarn lint
99
cache: yarn
1010
node_js:
11-
- "node"
11+
- 'node'

CODE_OF_CONDUCT.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
In the interest of fostering an open and welcoming environment, we as
66
contributors and maintainers pledge to making participation in our project and
77
our community a harassment-free experience for everyone, regardless of age, body
8-
size, disability, ethnicity, sex characteristics, gender identity and expression,
9-
level of experience, education, socio-economic status, nationality, personal
10-
appearance, race, religion, or sexual identity and orientation.
8+
size, disability, ethnicity, sex characteristics, gender identity and
9+
expression, level of experience, education, socio-economic status, nationality,
10+
personal appearance, race, religion, or sexual identity and orientation.
1111

1212
## Our Standards
1313

@@ -37,11 +37,11 @@ Project maintainers are responsible for clarifying the standards of acceptable
3737
behavior and are expected to take appropriate and fair corrective action in
3838
response to any instances of unacceptable behavior.
3939

40-
Project maintainers have the right and responsibility to remove, edit, or
41-
reject comments, commits, code, wiki edits, issues, and other contributions
42-
that are not aligned to this Code of Conduct, or to ban temporarily or
43-
permanently any contributor for other behaviors that they deem inappropriate,
44-
threatening, offensive, or harmful.
40+
Project maintainers have the right and responsibility to remove, edit, or reject
41+
comments, commits, code, wiki edits, issues, and other contributions that are
42+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
43+
contributor for other behaviors that they deem inappropriate, threatening,
44+
offensive, or harmful.
4545

4646
## Scope
4747

@@ -58,17 +58,19 @@ Instances of abusive, harassing, or otherwise unacceptable behavior may be
5858
reported by contacting the project team at [email protected]. All
5959
complaints will be reviewed and investigated and will result in a response that
6060
is deemed necessary and appropriate to the circumstances. The project team is
61-
obligated to maintain confidentiality with regard to the reporter of an incident.
62-
Further details of specific enforcement policies may be posted separately.
61+
obligated to maintain confidentiality with regard to the reporter of an
62+
incident. Further details of specific enforcement policies may be posted
63+
separately.
6364

6465
Project maintainers who do not follow or enforce the Code of Conduct in good
6566
faith may face temporary or permanent repercussions as determined by other
6667
members of the project's leadership.
6768

6869
## Attribution
6970

70-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71-
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
71+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
72+
version 1.4, available at
73+
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
7274

7375
[homepage]: https://www.contributor-covenant.org
7476

CONTRIBUTING.md

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,32 @@
22

33
Thanks for considering contributing!
44

5-
This project has been developed to serve use-cases that I have encountered with uploading files to codesandbox, and definitely doesn't cover all use-cases. I'd be happy though if you find something else you need for you to contribute a pull request. I'll make sure you get a review quickly.
5+
This project has been developed to serve use-cases that I have encountered with
6+
uploading files to codesandbox, and definitely doesn't cover all use-cases. I'd
7+
be happy though if you find something else you need for you to contribute a pull
8+
request. I'll make sure you get a review quickly.
69

7-
If you're not confident raising a pull request, open an issue, and I can talk to you about the feature/bug fix you're looking for, and hopefully we can work out how to do it.
10+
If you're not confident raising a pull request, open an issue, and I can talk to
11+
you about the feature/bug fix you're looking for, and hopefully we can work out
12+
how to do it.
813

914
## For issues
1015

11-
If you are reporting a bug, an attempt to understand where in our code the bug comes from, or an easy way to reproduce it is greatly appreciated!
16+
If you are reporting a bug, an attempt to understand where in our code the bug
17+
comes from, or an easy way to reproduce it is greatly appreciated!
1218

13-
If you are requesting a feature, please make sure your use-case for the feature is clearly stated, so it's easy to evaluate.
19+
If you are requesting a feature, please make sure your use-case for the feature
20+
is clearly stated, so it's easy to evaluate.
1421

1522
## Deving on this project
1623

17-
There are a couple of things that are probably good to know(TM) to dev on this project.
24+
There are a couple of things that are probably good to know(TM) to dev on this
25+
project.
1826

1927
### How do I get up and running?
2028

21-
We are using [bolt](https://github.com/boltpkg/bolt) to manage this monorepo. If you haven't worked on a bolt project, the quick get-up-and-running steps are:
29+
We are using [bolt](https://github.com/boltpkg/bolt) to manage this monorepo. If
30+
you haven't worked on a bolt project, the quick get-up-and-running steps are:
2231

2332
```sh
2433
yarn global add bolt
@@ -30,17 +39,20 @@ The `bolt` command will install npm packages and link them.
3039

3140
### Observing changes
3241

33-
If you are trying to observe changes across linked packages, you will need to make sure they are built.
42+
If you are trying to observe changes across linked packages, you will need to
43+
make sure they are built.
3444

35-
`yarn build` builds all packages.
36-
`yarn dev:csb` runs the build script for `codesandboxer` and watches it for changes.
37-
`yarn dev:rcsb` runs the build script for `react-codesandboxer` and watches it for changes.
45+
`yarn build` builds all packages. `yarn dev:csb` runs the build script for
46+
`codesandboxer` and watches it for changes. `yarn dev:rcsb` runs the build
47+
script for `react-codesandboxer` and watches it for changes.
3848

3949
The other packages do not need to be built.
4050

4151
### Validating changes
4252

43-
Currently validation that things work is mostly being done through tests. The most important tests being the ones in `codesandboxer` and `codesandboxer-fs` which use the `/fixtures` directory to validate how they parse and load files.
53+
Currently validation that things work is mostly being done through tests. The
54+
most important tests being the ones in `codesandboxer` and `codesandboxer-fs`
55+
which use the `/fixtures` directory to validate how they parse and load files.
4456

4557
## Adding Templates
4658

@@ -50,27 +62,44 @@ Codesandboxer currently supports:
5062
- create-react-app-typescript
5163
- vue-cli
5264

53-
It should be easy to add new templates. Here are the places you would need to modify:
65+
It should be easy to add new templates. Here are the places you would need to
66+
modify:
5467

55-
1. Add a template file to `packages/codesandboxer/templates/`.
56-
A template should include a main file that imports from `example.js` (or the relevant filetype), as well as any other necessary files to run the sandbox.
57-
1a. Once you have your template file, export it from `packages/codesandboxer/templates/index.js` added to the object with the name of the sandbox it is for.
58-
2. If you want a different template to be used for `codesandboxer-fs` add a template to `packages/codesandboxer-fs/templates` in the same way. (we tend to make templates for codesandboxer-fs call out the use of the sandboxer more explicitly, as it may be less clear how to debug it)
68+
1. Add a template file to `packages/codesandboxer/templates/`. A template should
69+
include a main file that imports from `example.js` (or the relevant
70+
filetype), as well as any other necessary files to run the sandbox. 1a. Once
71+
you have your template file, export it from
72+
`packages/codesandboxer/templates/index.js` added to the object with the name
73+
of the sandbox it is for.
74+
2. If you want a different template to be used for `codesandboxer-fs` add a
75+
template to `packages/codesandboxer-fs/templates` in the same way. (we tend
76+
to make templates for codesandboxer-fs call out the use of the sandboxer more
77+
explicitly, as it may be less clear how to debug it)
5978

6079
## For Pull Requests
6180

6281
### Code Standards
6382

64-
We're using flow to help keep our code neat. If you could add types to your code, that would be 😎. Code that adds tests for its use-cases is also great.
83+
We're using flow to help keep our code neat. If you could add types to your
84+
code, that would be 😎. Code that adds tests for its use-cases is also great.
6585

6686
### Documentation
6787

68-
If you add anything to the API, please update the documentation as well. (we also accept docs PRs if you see a way to improve our documentation)
88+
If you add anything to the API, please update the documentation as well. (we
89+
also accept docs PRs if you see a way to improve our documentation)
6990

7091
### Monitoring changes
7192

72-
We are using [build-releases](https://www.npmjs.com/package/@atlaskit/build-releases) to add intents to change, so we can make sure our packages are released at the right semantic version. The simple answer is run `yarn changeset` and answer the questions. If you're not certain about semantic versioning, I would recommend checking out [this documentation](https://docs.npmjs.com/about-semantic-versioning).
93+
We are using
94+
[build-releases](https://www.npmjs.com/package/@atlaskit/build-releases) to add
95+
intents to change, so we can make sure our packages are released at the right
96+
semantic version. The simple answer is run `yarn changeset` and answer the
97+
questions. If you're not certain about semantic versioning, I would recommend
98+
checking out
99+
[this documentation](https://docs.npmjs.com/about-semantic-versioning).
73100

74101
## Please Be Nice
75102

76-
I'm currently working on a code of conduct, but until that's ready, I wanted to make sure that everyone felt welcome here. If you are looking to contribute, please make sure you are respectful to anyone participating on this project.
103+
I'm currently working on a code of conduct, but until that's ready, I wanted to
104+
make sure that everyone felt welcome here. If you are looking to contribute,
105+
please make sure you are respectful to anyone participating on this project.

0 commit comments

Comments
 (0)