Skip to content

Commit

Permalink
style: add format and standards (#200)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikita Almanov <[email protected]>
  • Loading branch information
github-actions[bot] and nikkeyl committed Feb 1, 2024
1 parent 504cd2c commit 99af3ac
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
run: npm ci

- name: Lint
run: npm run lint:markdown
run: npm run lint:md
2 changes: 1 addition & 1 deletion .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
run: npm ci

- name: Lint
run: npm run fix:prettier --check
run: npm run lint:formatting
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.ecrc
.eslintignore
.gitignore
.prettierignore
*.md
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,39 +182,44 @@ This template includes ready-made solutions for integration with:

## Package.json scripts

- **`init`**: Installs **`node_modules`** and **`Husky`**.
- **`init`**: Installs dependencies, **Husky** and update submodules.

- **`fix:prettier`**: Runs **`Prettier`** with the **`--write`** flag.
- **`format`**: Runs **Prettier** with the **`--write`** flag
for all files.

- **`lint:formatting`**: Runs **Prettier** with the **`--check`** flag
for all files.

> In the [**`prettier.yml`**](https://github.com/Conqueror-Site-Builder/conqueror-repo-template/blob/main/.github/workflows/prettier.yml)
> workflow, **`Prettier`** is run with the **`--check`** flag.
>
> Also run with a **`pre-commit`** hook.
- **`lint:editorconfig`**: Runs **`Editorconfig Checker`** and
- **`lint:editorconfig`**: Runs **Editorconfig Checker** and
checks all files in the project.

> Also runs with the [**`editorconfig.yml`**](https://github.com/Conqueror-Site-Builder/conqueror-repo-template/blob/main/.github/workflows/editorconfig.yml)
> workflow.
- **`lint:markdown`**: Runs **`Remark`** with the **`--quiet`** flag and
checks all markdown files.
- **`lint:md`**: Runs **Remark** with the **`--quiet`** flag and
checks all **markdown** files.

> Also runs with the [**`markdown.yml`**](https://github.com/Conqueror-Site-Builder/conqueror-repo-template/blob/main/.github/workflows/markdown.yml)
> workflow.
- **`lint:ts`**: Runs **`ESLint`** with the flag **`--fix`**
- **`lint:ts`**: Runs **ESLint** with the flag **`--fix`**
for all **TypeScript** files.

> Also runs with the [**`eslint.yml`**](https://github.com/Conqueror-Site-Builder/conqueror-repo-template/blob/main/.github/workflows/eslint.yml)
> Runs with the [**`eslint.yml`**](https://github.com/Conqueror-Site-Builder/conqueror-repo-template/blob/main/.github/workflows/eslint.yml)
> workflow.
>
> Also run with a **`pre-commit`** hook.
- **`test`**: Runs **`Mocha`** and the tests in the **specs/** folder.
- **`test`**: Runs **Mocha** and the tests in the **specs/** folder.

> Also runs using the [**`mocha.yml`**](https://github.com/Conqueror-Site-Builder/conqueror-repo-template/blob/main/.github/workflows/mocha.yml)
> workflow.
- **`commit`**: Runs **`Commitizen`**, **`Commitlint`**, and **`Husky`** to
- **`commit`**: Runs **Commitizen**, **Commitlint**, and **Husky** to
create commits according to **Conventional Commits** standards.

## Workflows
Expand Down
56 changes: 29 additions & 27 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
export default {
root: true,
env: {
browser: true,
es6: true,
export default [
{
root: true,
env: {
browser: true,
es6: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
project: 'tsconfig.json',
sourceType: 'module',
},
extends: [
'airbnb-typescript/base',
'plugin:unicorn/recommended',
'plugin:@typescript-eslint/recommended-type-checked',
],
plugins: ['import', 'unicorn'],
rules: {
'import/exports-last': 'error',
'import/group-exports': 'warn',
'import/no-commonjs': 'error',
'import/no-namespace': 'error',
'import/no-unassigned-import': 'error',
'unicorn/no-unused-properties': 'error',
'unicorn/string-content': 'error',
},
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
project: 'tsconfig.json',
sourceType: 'module',
},
extends: [
'airbnb-typescript/base',
'plugin:unicorn/recommended',
'plugin:@typescript-eslint/recommended-type-checked',
],
plugins: ['import', 'unicorn'],
rules: {
'import/exports-last': 'error',
'import/group-exports': 'warn',
'import/no-commonjs': 'error',
'import/no-namespace': 'error',
'import/no-unassigned-import': 'error',
'unicorn/no-unused-properties': 'error',
'unicorn/string-content': 'error',
},
};
];
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"type": "module",
"scripts": {
"init": "npm i && husky install",
"fix:prettier": "prettier . --write",
"init": "npm i && husky install && git submodule init && git submodule update",
"format": "prettier . --write",
"lint:formatting": "prettier . --check",
"lint:editorconfig": "editorconfig-checker",
"lint:markdown": "remark . --quiet",
"lint:md": "remark . --quiet",
"lint:ts": "eslint **/*.ts --fix",
"test": "mocha",
"commit": "cz"
Expand Down

0 comments on commit 99af3ac

Please sign in to comment.