Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
hamid-Ft committed Nov 25, 2023
1 parent fa8610e commit 519e045
Show file tree
Hide file tree
Showing 14 changed files with 21,305 additions and 17,790 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
public
build
dist
64 changes: 42 additions & 22 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,25 +1,45 @@
module.exports = {
root: true,
env: { browser: true, es2021: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
root: true,
env: { browser: true, es2020: true },
extends: [
'airbnb-typescript',
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/np',
parserOptions: {
project: './tsconfig.json',
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2020,
sourceType: 'module',
},
ecmaVersion: 'latest',
sourceType: 'module',
},
settings: { react: { version: 'detect' } },
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
},
settings: { react: { version: 'detect' } },
plugins: ['prettier', '@typescript-eslint', 'react-refresh'],
rules: {
'linebreak-style': ['error', 'windows'],
'react/no-danger': 'off', // it's self explainatory that no-danger should be used sparingly
'react/react-in-jsx-scope': 'off', // next.js does not require react in most components
'react/prop-types': 'off', // as long as TS strict mode is off this is not required
'prettier/prettier': 'error',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
overrides: [
{
files: ['vite.config.ts'],
rules: {
'import/no-extraneous-dependencies': 'off',
},
},
],
};
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: ci

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

jobs:
ci:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node: [20]

steps:
- name: Checkout
uses: actions/checkout@master

- name: Setup node env
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}

- name: Cache node_modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci

- name: Run code style check
run: npm run style:all
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 style:lint
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run style:all
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
public
build
dist
13 changes: 0 additions & 13 deletions .prettierrc.js

This file was deleted.

11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 80,
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"bracketSameLine": true,
"arrowParens": "avoid",
"htmlWhitespaceSensitivity": "css"
}
Loading

0 comments on commit 519e045

Please sign in to comment.