Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set linter, formatter, package maanger, lint workflow #1

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
__generated__
**/*
110 changes: 110 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jest": true,
"node": true
},
"settings": {
"react": {
"version": "detect"
},
"import/resolver": {
"node": {
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
}
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"prettier",
"airbnb",
"airbnb/hooks",
"eslint-config-prettier",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:@next/next/recommended"
],
"ignorePatterns": [
"node_modules/",
".next/*",
"*.js",
"lib/image/loader.ts",
"*/*.stories.*"
],
"rules": {
"no-console": 0,
// 'import/extensions': ['error', 'ignorePackages', { js: 'never', jsx: 'never', ts: 'never', tsx: 'never', json: 'never' }],
"import/no-unresolved": 0,
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
// or "error"
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
],
"lines-between-class-members": 0,
"react/jsx-filename-extension": [
1,
{
"extensions": [
".ts",
".tsx",
".js",
".jsx"
]
}
],
"react/function-component-definition": [
2,
{
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function"
}
],
// 'react/destructuring-assignment': [true, { 'extensions': ['.jsx', '.tsx'] }],
"import/prefer-default-export": "off",
"import/extensions": [
"off"
],
"import/order": "off",
"react/jsx-props-no-spreading": "off",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"no-use-before-define": "off",
"no-shadow": "off",
"import/no-extraneous-dependencies": "off",
"react/destructuring-assignment": "off",
"comma-dangle": [
"off",
"always-multiline"
],
"prettier/prettier": [
"off",
{
"endOfLine": "auto"
}
]
}
}
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Lint

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 18

# ESLint and Prettier must be in `package.json`
- name: Install Node.js dependencies
run: npm install -g pnpm && pnpm install

- name: Run linters
uses: wearerequired/lint-action@v2
with:
eslint: true
prettier: true
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
__generated__
.next
storybook-static
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"printWidth": 160,
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "lf",
"parser": "typescript"
}
Loading
Loading