-
Notifications
You must be signed in to change notification settings - Fork 44
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
CI (Continuous Integration) pipeline added #79
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 2021, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
node: true, | ||
}, | ||
root: true, | ||
extends: [ | ||
'next', | ||
'eslint:recommended', | ||
'prettier', | ||
'next/core-web-vitals', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react/recommended', | ||
'plugin:prettier/recommended', | ||
'plugin:react-hooks/recommended', | ||
], | ||
plugins: ['prettier', '@typescript-eslint', 'react', 'react-hooks'], | ||
rules: { | ||
// JavaScript rules | ||
'prefer-const': 'warn', | ||
'no-var': 'warn', | ||
'no-unused-vars': 'warn', | ||
'object-shorthand': 'warn', | ||
'quote-props': ['warn', 'as-needed'], | ||
// TypeScript rules | ||
'@typescript-eslint/array-type': [ | ||
'warn', | ||
{ | ||
default: 'array', | ||
}, | ||
], | ||
'@typescript-eslint/consistent-type-assertions': [ | ||
'warn', | ||
{ | ||
assertionStyle: 'as', | ||
objectLiteralTypeAssertions: 'never', | ||
}, | ||
], | ||
// React rules | ||
'react/jsx-fragments': ['warn', 'syntax'], // Shorthand syntax for React fragments | ||
'react/jsx-filename-extension': [ | ||
'warn', | ||
{ | ||
extensions: ['ts', 'tsx'], | ||
}, | ||
], | ||
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks | ||
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies | ||
'react/react-in-jsx-scope': 'off', | ||
'react/prop-types': 'off', | ||
'prettier/prettier': 'warn', | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,27 @@ | ||||||
name: Continuous Integration | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change the name to what it is doing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok rename it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please make it: Lint and Format |
||||||
|
||||||
on: | ||||||
push: | ||||||
pull_request: | ||||||
|
||||||
jobs: | ||||||
build: | ||||||
runs-on: ubuntu-latest | ||||||
|
||||||
steps: | ||||||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7 | ||||||
with: | ||||||
fetch-depth: 0 # Fetch all history for all branches and tags | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to all branches? Also, we don't have any tags There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should I add this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we don't need it. Please check |
||||||
- name: Use Node.js | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make smallercase N in nodejs |
||||||
uses: actions/setup-node@v2 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same goes for this:
Suggested change
|
||||||
with: | ||||||
node-version: '20.9.0' | ||||||
|
||||||
- name: Install dependencies | ||||||
run: npm install | ||||||
|
||||||
- name: Run lint | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which lint we are running. Can we please add the name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should i rename it to
|
||||||
run: npm run lint | ||||||
|
||||||
- name: Run format check | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. which format we are running. Can we please add the name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
run: npm run format |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,14 @@ yarn-error.log* | |
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts | ||
|
||
# Ignore all files in the app directory | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we are adding these here? |
||
/app/* | ||
/components/* | ||
|
||
# Except the about/page.tsx file | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we are adding these here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I commit the file the prettier and eslinter fixes each and every file and because I did't wanted to commit . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These files are the files on which check should happen. Once Linter, and format will execute yes they will show errors and requires fixes across project. This is wrong to put the files in gitignore. |
||
!/app/about/page.tsx | ||
!/components/ui/calendar.tsx | ||
!/components/ui/.commandtsx | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npx lint-staged |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"*/**/*.{js,jsx,ts,tsx}": [ | ||
"prettier --write", | ||
"eslint --fix", | ||
"eslint" | ||
], | ||
"*/**/*.{json,css,md}": [ | ||
"prettier --write" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#Ignore Artifacts | ||
.next/ | ||
|
||
#Ignore Specific Items | ||
package-lock.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"semi": true, | ||
"singleQuote": true, | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these changes should not be here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They were done by the prettier formatter , shuld I drop them in the next commit? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you run the PR at your local? These changes should be for across the project |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,4 +148,4 @@ export default async function page() { | |
</section> | ||
</> | ||
); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion (non-blocking): Not sure, why our formatter removes the newline at the end, usually it's a good practice to have newline at the end. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My guess is formatter is not installed properly. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,4 +122,4 @@ export default async function page() { | |
</section> */} | ||
</div> | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: I would generally suggest using the new stable versions of actions and always use pinned GHA (here's why -- tl;dr; for better security and to prevent us from SLSA attacks)