Skip to content

Commit

Permalink
Fixes #23 by adding linters and pre-commit hook
Browse files Browse the repository at this point in the history
Rename prettier config file
Add README.md
Update values for semi, tabWidth, and  add new props
Add information about ways to contribute
Add link to CONTRIBUTION.md
Update formatting, scripts, and dependencies
Update tabwidth
Add recommended extensions
Add default settings for browser
Update prettierignore
Add eslintignore
Add husky configuration
Add eslint configuration
add lintstaged config
Update precommit settings
Refactored and reformatted using linters
Reformatted using prettier
Ignore webpack, css, and json files
Update command
  • Loading branch information
SerpentBytes committed Nov 12, 2022
1 parent 5c613b3 commit 7dbea09
Show file tree
Hide file tree
Showing 25 changed files with 10,303 additions and 6,642 deletions.
24 changes: 12 additions & 12 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"plugins": [
"@babel/syntax-dynamic-import",
"@babel/plugin-syntax-import-assertions"
],
"sourceType": "module",
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
]
"plugins": [
"@babel/syntax-dynamic-import",
"@babel/plugin-syntax-import-assertions"
],
"sourceType": "module",
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
]
]
}
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Ignore artifacts:
build
node_modules
.*
dist
*.md
webpack.config.js
*.json
*.css
45 changes: 45 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": ["airbnb-base", "prettier"],
"overrides": [],
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
"no-duplicate-imports": ["error", { "includeExports": true }],
"no-invalid-regexp": "error",
"no-this-before-super": "error",
"no-unexpected-multiline": "warn",
"no-unused-vars": "error",
"no-use-before-define": "error",
"accessor-pairs": "error",
"arrow-body-style": ["error", "as-needed"],
"camelcase": ["error", { "ignoreImports": true }],
"func-name-matching": "error",
"no-confusing-arrow": "warn",
"no-empty": "warn",
"no-empty-function": "error",
"no-useless-call": "error",
"no-useless-catch": "error",
"no-useless-return": "warn",
"no-var": "error",
"prefer-arrow-callback": "warn",
"require-await": "warn",
"no-trailing-spaces": [
"error",
{ "skipBlankLines": true, "ignoreComments": true }
],
"import/extensions": "off",
"no-console": "off",
"import/no-cycle": "off",
"no-nested-ternary": "off",
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
"array-callback-return": "off"
}
}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run pre-commit
3 changes: 3 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*": "npx eslint --fix"
}
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Ignore artifacts:
build
node_modules
.git
.*
dist
*.md
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"arrowParens": "always"
}
6 changes: 0 additions & 6 deletions .prettierrc.json

This file was deleted.

7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"eamodio.gitlens"
]
}
26 changes: 13 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/build/index.js"
}
]
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/build/index.js"
}
]
}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"files.eol": "\n"
}
104 changes: 104 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Contributing to Siteit

Thank you for showing interest in contributing to Siteit.

We encourage all sorts of contributions, whether your changes improve the source code or enhance the documentation. Please read [Table of Contents](#table-of-contents) to get started.

---

## Table of Contents
- [Code Contribution](#code-contribution)
- [Reporting Bugs](#reporting-bugs)
- [Suggesting Enhancements](#suggesting-enhancements)
- [Improving the Documentation](#improving-the-documentation)
- [Styleguides](#styleguides)
- [Commit Messages](#commit-messages)

---

### Code Contribution
This section is to help developers set up Siteit locally on their machines for development.

#### Getting Started

#### Pre-requisites

Make sure you have the following technologies installed on your machine:
- [Node](https://nodejs.org/en/download/)current LTS version.
- [npm](https://docs.npmjs.com/about-npm#use-npm-to---) current release.

An easy to way to test if you already have the above technologies installed is by running the following commands:
```node
node -v
npm -v
```
If you have `node` and `npm` installed, the above commands will print the installed `version` information.

_If you get an error message, please install the missing technology._

**Note**:
We recommend installing the [current LTS version of [`node`](https://nodejs.org/en/download/) for your operating system to test and develop Siteit without complications.

#### Getting Started
- [`fork`](https://docs.github.com/en/get-started/quickstart/fork-a-repo) the Siteit on Github.
- Use `git clone` to `clone` the forked repo to your local machine
- `cd` into the cloned directory, and create a new `branch` for your changes.
- Run `npm link` to run Siteit locally on your machine
- Run `npm start` to start Siteit

##### About `npm start`
This script builds the source code using `babel`, and starts an instance of `siteit` on your machine.

#### Making Changes
*Note:*
- Make all your changes in a new `git` `branch`. Learn more about creating branches [here](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging)
- Make changes only in the `src` folder

To run Siteit locally with changes you introduced to the source code, you need to run the following script:
```node
npm run build
```
Running the above script will compile the code using `babel` and output in the `build` folder.

_Modify the files in `src` folder, as files within the `build` folder are overwritten when the source code is compiled using `babel`._

##### Starting the Project
Assuming you ran the `npm link` previously as instructed, run `npm run start` to start Siteit locally. Alternatively, you can start the project by running `node ./build/index.js` from the command line.

##### Statically Generated Content
If you ran the tool using options that accepts a `source` as an `argument`, the rendered HTML will can be found in the `dist` under `root`.

#### Formatting and Error Checking
Frequently check your code for formatting and other problems using the following commands:

`npm run prettier:check`
Running the above script will run tests to check for formatting errors in the `src` folder, using `prettier`.

`npm run lint`
Running the above script will run tests to check for problems in the code using `ESLint`.

---

To automatically apply the changes detected by using `prettier` and `ESLint`, use the following scripts:

```node
npm run prettier:format
npm run lint:fix
```

---

**Note:**
If you push changes without running checks for formatting and problems in code, the `husky` `pre-commit` `hook` will automatically apply the changes before pushing your changes remotely to GitHub.


### Reporting Bugs
_WIP_
### Suggesting Enhancements
_WIP_
### Improving the Documentation
_WIP_
### Styleguides
_WIP_
### Commit Messages
_WIP_
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Siteit **fully** supports the following markdown features:
| name | syntax | output |
| --------------- | ------------ | -------------------- |
| Bold text | `**Some bold Text**` | `<strong>Some bold text<strong/>` |
| " | `__Some bold text__` | `<strong>Some bold text<strong/>` |
| " | `__Some bold text__` | `<strong>Some bold text<strong/>` |
| Italic text | `*Some italic text*` | `<em>Some italic text</em>` |
| " | `_Some italic text_` | `<em>Some italic text</em>` |
| Deleted text | `~~Some deleted text~~` | `<del>Some italic text</del>` |
Expand All @@ -62,3 +62,7 @@ Siteit **fully** supports the following markdown features:
| Heading 1 | `# Heading` | `<h1>Heading</h1>` |

**As of recent commit additional markdown features are supported with inconsistent CSS styling. Full support will be _officially_ introduced in subsequent commits**

---
## Contributing
If you are interested in contributing code to Siteit, see our contribution guidelines [here](./CONTRIBUTING.md).
Loading

0 comments on commit 7dbea09

Please sign in to comment.