Skip to content

Commit

Permalink
Merge pull request #73 from bitcoin-sv/BUX-687/Prettier
Browse files Browse the repository at this point in the history
feat(bux-687): changed prettier config
  • Loading branch information
Nazarii-4chain authored Apr 12, 2024
2 parents 0307514 + ccdf04e commit 97118ee
Show file tree
Hide file tree
Showing 178 changed files with 1,697 additions and 1,717 deletions.
49 changes: 22 additions & 27 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module.exports = {
"env": {
"browser": true,
"node": true,
"es6": true,
env: {
browser: true,
node: true,
es6: true,
},
"settings": {
"react": {
"version": "detect"
settings: {
react: {
version: 'detect',
},
'import/resolver': {
node: {
Expand All @@ -19,7 +19,7 @@ module.exports = {
},
},
},
"extends": [
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
Expand All @@ -29,30 +29,25 @@ module.exports = {
'prettier',
'eslint-config-prettier',
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
project: "./tsconfig.json"
overrides: [],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: './tsconfig.json',
},
"plugins": [
"react",
"@emotion",
"@typescript-eslint"
],
"rules": {
"react/no-unescaped-entities": 0,
"react/react-in-jsx-scope": "off",
plugins: ['react', '@emotion', '@typescript-eslint'],
rules: {
'react/no-unescaped-entities': 0,
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'react/jsx-curly-brace-presence': ['warn', { props: 'never', children: 'never' }],
'react/self-closing-comp': [
'warn',
{
'component': true,
'html': true,
component: true,
html: true,
},
],
'@typescript-eslint/ban-ts-comment': [
Expand All @@ -64,5 +59,5 @@ module.exports = {
'@emotion/pkg-renaming': 'error',
'@emotion/no-vanilla': 'error',
'@emotion/syntax-preference': [2, 'string'],
}
}
},
};
6 changes: 0 additions & 6 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,27 @@ The primary goal of this project is to foster an inclusive, respectful, and open
## 2. Open Discussions & Respectful Feedback

- **Encourage Diverse Ideas:** Everyone brings a unique perspective. Encourage different viewpoints, and listen openly to each other’s ideas.

- **Constructive Feedback:** Focus on providing constructive feedback rather than criticizing individuals. Discuss ideas, not the person presenting them.

- **Avoid Harmful Language:** Refrain from using offensive or harmful language, including but not limited to sexist, racist, homophobic, transphobic, ableist, or discriminatory remarks.

## 3. No Politics or Off-topic Discussions

- **Stay On Topic:** Keep discussions focused on the project and avoid bringing in off-topic or political discussions.

- **Respectful Discourse:** If discussions become heated, maintain a level of respect and understanding, and work towards a compromise.

## 4. Reporting & Enforcement

- **Report Violations:** If you observe a violation of this Code of Conduct, please report it by contacting the project team members.

- **Consequences:** Violations of this Code of Conduct may result in temporary or permanent banning from the project community.

## 5. Inclusion & Diversity

- **Welcome Everyone:** Foster an environment where everyone feels welcome, regardless of their background, identity, or level of experience.

- **Help Newcomers:** Offer help and guidance to newcomers to make them feel welcome in our community.

## 6. Be Kind & Courteous

- **Respect Time & Effort:** Recognize and respect the time and effort put in by contributors and maintainers.

- **Courtesy:** Be courteous and polite. Treat others as you would like to be treated.

By participating in this project, you agree to abide by this Code of Conduct. Let’s work together to make this community respectful and inclusive for everyone.
40 changes: 20 additions & 20 deletions .github/CODE_STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const person = {
firstName: 'Bill',
lastName: null, // 🟥
lastName: '', //
}
};
```

- If for some reason a default value cannot be assigned or it is impractical to assign a default value, assign a `null` value rather than an `undefined` value.
Expand All @@ -87,40 +87,40 @@ const person = {
firstName: 'Bill',
address: undefined, // 🟥
address: null, //
}
};
```

- When code you have no control over (external library) or JavaScript itself may return undefined, convert it to null (or preferably to a default value if possible).

```ts
const found = arr.find((item) => item > 5) // 🟥
const found = arr.find((item) => item > 5) ?? null //
const found = arr.find((item) => item > 5); // 🟥
const found = arr.find((item) => item > 5) ?? null; //
```

- Whenever writing TypeScript code, avoid using `any` and always annotate types for Props passed to a Component.

```ts
interface MyComponentProps {
setName: any // 🟥
setName: React.Dispatch<React.SetStateAction<string>> //
setName: any; // 🟥
setName: React.Dispatch<React.SetStateAction<string>>; //
}

const MyComponent = (props: any) => {} // 🟥
const MyComponent: FC<MyComponentProps> = ({ setName }) => {} //
const MyComponent = (props: any) => {}; // 🟥
const MyComponent: FC<MyComponentProps> = ({ setName }) => {}; //
```

- Use curly braces `{}` instead of `new Object()`.

```ts
const newObject = new Object() // 🟥
const newObject = {} //
const newObject = new Object(); // 🟥
const newObject = {}; //
```

- Use brackets `[]` instead of `new Array()`.

```ts
const newArray = new Array() // 🟥
const newArray = [] //
const newArray = new Array(); // 🟥
const newArray = []; //
```

- Use `===` and `!==` instead of `==` and `!=`.
Expand Down Expand Up @@ -154,8 +154,8 @@ List of all categorized html tags with short description: [HTML Elements Referen
- When an import needs to go to more than one directory above, use full-path imports.
```typescript
import { MyComponent } from '../../../MyComponent' // 🟥
import { MyComponent } from '/src/components/MyComponent' //
import { MyComponent } from '../../../MyComponent'; // 🟥
import { MyComponent } from '/src/components/MyComponent'; //
```
### 2.2 File structure
Expand Down Expand Up @@ -214,19 +214,19 @@ Developers are required to diligently cover their changes with tests and organiz
- **Then**: Verify if the outcomes match the expectations.
```js
import { importantFunction } from './index.js'
import { importantFunction } from './index.js';

test('Test Something Very Useful Is Happening', () => {
// given
const functionInput = 'importantInput'
const expectedResult = 'importantResult'
const functionInput = 'importantInput';
const expectedResult = 'importantResult';

// when
const result = importantFunction(functionInput)
const result = importantFunction(functionInput);

// then
expect(result).toBe(expectedResult)
})
expect(result).toBe(expectedResult);
});
```
4. **Test Isolation**: Ensure test isolation by avoiding the use of global variables and shared state. Each test should be independent and not rely on the execution of other tests. If a test requires a shared state, use a setup function to create the state before each test.
Expand Down
8 changes: 6 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
---
name: Feature request
about: Suggest an idea for a new feature or improvement
title: "[FEATURE]"
title: '[FEATURE]'
labels: enhancement
assignees: ''

---

## Desired Solution

A clear and concise description of what you want to happen. Describe how the new feature should work and what problems it should solve. If possible, including mockups, diagrams, or sample code can be helpful.

## Suggested Implementation

In this section, you can present ideas on how the new feature could be implemented. Suggest where in the code changes should be made and what libraries or tools might be useful.

## Alternatives Considered

Describe alternative solutions or features that have been considered. Why was this particular solution chosen? What are the pros and cons of the alternative options?

## Additional Context

Add any other context or screenshots about the feature request here. If the proposal involves visual elements, it’s good to attach screenshots, videos, or other materials illustrating the proposed changes.

## Categorize Feature

If it's possible try categorize the request - if it's UX Improvement, Security Improvement or maybe the changed is related to the application performance.
11 changes: 5 additions & 6 deletions .github/ISSUE_TEMPLATE/issue-template.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
---
name: Issue Template
about: Create a report to help us fix bugs/inaccuracies
title: "[BUG]"
title: '[BUG]'
labels: bug
assignees: ''

---

**TL;DR**
Check if your issue answers those question:

- [ ] Does my issue clearly describe what exactly is not working properly?
- [ ] Does my issue clearly describe what are my expectations and what is the current output?
- [ ] Did I attach logs/screenshots/errors which ocured?
- [ ] Did I provide information how I run the code/library/application and on which platform/browser?
- [ ] Does my issue clearly describe what exactly is not working properly?
- [ ] Does my issue clearly describe what are my expectations and what is the current output?
- [ ] Did I attach logs/screenshots/errors which ocured?
- [ ] Did I provide information how I run the code/library/application and on which platform/browser?

**Describe the bug**
A clear and concise description of what the bug is.
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/autotag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ permissions:

on:
push:
branches: [ master,main ]
branches: [master, main]

jobs:
tag-version:
Expand All @@ -13,9 +13,9 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# Because of some github action optimisation [discussed here](https://github.com/orgs/community/discussions/27028)
# We're using Deploy key
ssh-key: "${{ secrets.DEPLOYMENT_KEY }}"
# Because of some github action optimisation [discussed here](https://github.com/orgs/community/discussions/27028)
# We're using Deploy key
ssh-key: '${{ secrets.DEPLOYMENT_KEY }}'

- name: Create version tag
run: ./release/tag-next-version.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "On pull request"
name: 'On pull request'

on:
pull_request_target:
Expand Down
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"bracketSpacing": true,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 120
}
14 changes: 0 additions & 14 deletions .prettierrc.cjs

This file was deleted.

4 changes: 2 additions & 2 deletions release/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
snapshot:
name_template: "{{ .Tag }}-Snapshot"
name_template: '{{ .Tag }}-Snapshot'
dist: release
changelog:
sort: asc
Expand All @@ -22,4 +22,4 @@ builds:
# ---------------------------
release:
prerelease: false
name_template: "Release v{{.Version}}"
name_template: 'Release v{{.Version}}'
Loading

0 comments on commit 97118ee

Please sign in to comment.