Skip to content

Commit

Permalink
Add Prettier Lint for CI (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yureien authored Dec 12, 2023
1 parent 5d1d3f8 commit 5146355
Show file tree
Hide file tree
Showing 56 changed files with 3,305 additions and 2,926 deletions.
56 changes: 28 additions & 28 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
es2017: true,
node: true
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
]
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
extraFileExtensions: ['.svelte'],
},
env: {
browser: true,
es2017: true,
node: true,
},
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
},
},
],
};
File renamed without changes.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Continuous Integration

on:
pull_request:
push:
branches: [main]

jobs:
prettier:
name: Prettier Check
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Run Prettier
id: prettier-run
uses: rutajdash/prettier-cli-action@v1.0.0
with:
config_path: ./.prettierrc
prettier_version: "3.1.1"

# This step only runs if prettier finds errors causing the previous step to fail
# This steps lists the files where errors were found
- name: Prettier Output
if: ${{ failure() }}
shell: bash
run: |
echo "The following files are not formatted:"
echo "${{steps.prettier-run.outputs.prettier_output}}"
15 changes: 2 additions & 13 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,2 @@
.DS_Store
node_modules
/build
/.svelte-kit
/package
.env
.env.*
!.env.example

# Ignore files for PNPM, NPM and YARN
pnpm-lock.yaml
package-lock.json
yarn.lock
*.yml
*.yaml
11 changes: 4 additions & 7 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"pluginSearchDirs": ["."],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
"singleQuote": true,
"tabWidth": 4,
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
56 changes: 28 additions & 28 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,44 @@

#### Body

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| `content` | `string` | Paste content. If encrypted, must be encoded into a string (preferably Base64). | Yes |
| `config` | `object` | Configuration for the paste | No |
| `passwordProtected` | `boolean` | Whether the paste is password protected. | No |
| `initVector` | `string` | Initialization vector for AES encryption. Max length: 64. | No |
| Name | Type | Description | Required |
| ------------------- | --------- | ------------------------------------------------------------------------------- | -------- |
| `content` | `string` | Paste content. If encrypted, must be encoded into a string (preferably Base64). | Yes |
| `config` | `object` | Configuration for the paste | No |
| `passwordProtected` | `boolean` | Whether the paste is password protected. | No |
| `initVector` | `string` | Initialization vector for AES encryption. Max length: 64. | No |

**Config Object:**

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| `language` | `string` | Programming language of the paste. Default: `plaintext`. | No |
| `encrypted` | `boolean` | Whether the paste is encrypted. Default: `false`. | No |
| `expiresAfter` | `number` | Time in seconds until the paste expires. | No |
| `burnAfterRead` | `boolean` | Whether the paste is deleted after reading. | No |
| Name | Type | Description | Required |
| --------------- | --------- | -------------------------------------------------------- | -------- |
| `language` | `string` | Programming language of the paste. Default: `plaintext`. | No |
| `encrypted` | `boolean` | Whether the paste is encrypted. Default: `false`. | No |
| `expiresAfter` | `number` | Time in seconds until the paste expires. | No |
| `burnAfterRead` | `boolean` | Whether the paste is deleted after reading. | No |

### Examples

```json
{
"content": "i0n3PW6qDUhDaTrzoKg+/ip4qQwu+iq8/fWDVg==",
"config": {
"language": "plaintext",
"encrypted": true,
"expiresAfter": 3600,
"burnAfterRead": false
},
"passwordProtected": false,
"initVector": "27DIWK00yDiGx001"
"content": "i0n3PW6qDUhDaTrzoKg+/ip4qQwu+iq8/fWDVg==",
"config": {
"language": "plaintext",
"encrypted": true,
"expiresAfter": 3600,
"burnAfterRead": false
},
"passwordProtected": false,
"initVector": "27DIWK00yDiGx001"
}
```

```json
{
"content": "Hello World!",
"config": {
"language": "plaintext"
}
"content": "Hello World!",
"config": {
"language": "plaintext"
}
}
```

Expand All @@ -57,6 +57,6 @@

#### Query Parameters

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| `key` | `string` | Paste key. | Yes |
| Name | Type | Description | Required |
| ----- | -------- | ----------- | -------- |
| `key` | `string` | Paste key. | Yes |
32 changes: 16 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Contributing

When contributing to this repository, please first discuss the change you wish to make via issue,
email, or any other method with the owners of this repository before making a change.
email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
build.
2. Update the README.md with details of changes to the interface, this includes new environment
2. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
3. Ensure that the code is adhering to the existing code style.

Expand All @@ -29,22 +29,22 @@ orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

### Our Responsibilities

Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@

Well, cause no pastebin I could find had ALL of the following features:

- Modern and minimal UI (This site's design was inspired by bin).
- Optional end-to-end encryption (we're using AES-256-GCM) with optional password protection (using PBKDF2).
- Syntax highlighting (using Prism) that supports 297 languages.
- API support to create and get pastes from command line.
- View raw pastes. Normally, encrypted pastebins do not have this. With this site, you can either get the Base64-encoded encrypted paste, or decrypt it on the server side (even with the password) and get the raw paste.
- Keyboard shortcuts!
- And of course, being fully open-source and easily self-hostable.
- Ability to edit pastes after creation, and a dashboard for viewing all your pastes.
- **NEW** Feature to use custom path names.
- **Comes with a CLI tool to create and read pastes from the command line!**

## API Documentation
- Modern and minimal UI (This site's design was inspired by bin).
- Optional end-to-end encryption (we're using AES-256-GCM) with optional password protection (using PBKDF2).
- Syntax highlighting (using Prism) that supports 297 languages.
- API support to create and get pastes from command line.
- View raw pastes. Normally, encrypted pastebins do not have this. With this site, you can either get the Base64-encoded encrypted paste, or decrypt it on the server side (even with the password) and get the raw paste.
- Keyboard shortcuts!
- And of course, being fully open-source and easily self-hostable.
- Ability to edit pastes after creation, and a dashboard for viewing all your pastes.
- **NEW** Feature to use custom path names.
- **Comes with a CLI tool to create and read pastes from the command line!**

## API Documentation

See [API.md](API.md).

Expand Down
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ options:
-h, --help show this help message and exit
--password PASSWORD, -p PASSWORD
Password to decrypt the paste with. Only needed if password-protected.
```
```
Loading

0 comments on commit 5146355

Please sign in to comment.