Skip to content

Commit

Permalink
Merge pull request #258 from TogetherCrew/feat/refactor-old-codes
Browse files Browse the repository at this point in the history
Feat/refactor old codes
  • Loading branch information
mehdi-torabiv authored Feb 20, 2024
2 parents 38f3ccd + 46c9b2e commit 534fcfc
Show file tree
Hide file tree
Showing 249 changed files with 4,017 additions and 3,374 deletions.
88 changes: 74 additions & 14 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,81 @@
module.exports = {
env: {
browser: true,
es2021: true
es2021: true,
node: true,
},
plugins: ['@typescript-eslint', 'simple-import-sort', 'unused-imports'],
extends: [
'plugin:react/recommended',
'standard-with-typescript'
],
overrides: [
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: [
'react'
'eslint:recommended',
'next',
'next/core-web-vitals',
'plugin:@typescript-eslint/recommended',
'prettier',
],
rules: {
}
}
'no-unused-vars': 'off', // Disabling base rule as it's handled by @typescript-eslint/no-unused-vars
'no-console': 'warn', // Allow console with warning to identify usage
'@typescript-eslint/explicit-module-boundary-types': 'off', // Disabling requirement for explicit return types on functions
'react/no-unescaped-entities': 'off', // Disable warnings for unescaped entities in JSX
'react/display-name': 'off', // Disable display name rule for React components
'react/jsx-curly-brace-presence': [
'warn',
{ props: 'never', children: 'never' },
], // Enforce no unnecessary curly braces in JSX
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-types': 'off',
'no-empty': 'off',
'no-fallthrough': 'off',
'react/jsx-key': 'warn',
'react/no-children-prop': 'off',
'no-prototype-builtins': 'warn',
'no-case-declarations': 'warn',
'react-hooks/exhaustive-deps': 'off',

// Disable rule for unused vars but enable warning for unused imports and vars with specific patterns
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'warn',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_', // Ignore vars with _ prefix
args: 'after-used',
argsIgnorePattern: '^_', // Ignore args with _ prefix
},
],

// Configuring import sorting
'simple-import-sort/exports': 'warn',
'simple-import-sort/imports': [
'warn',
{
groups: [
['^@?\\w', '^\\u0000'],
['^.+\\.s?css$'],
['^@/lib', '^@/hooks'],
['^@/data'],
['^@/components', '^@/container'],
['^@/store'],
['^@/'],
[
'^\\./?$',
'^\\.(?!/?$)',
'^\\.\\./?$',
'^\\.\\.(?!/?$)',
'^\\.\\./\\.\\./?$',
'^\\.\\./\\.\\.(?!/?$)',
'^\\.\\./\\.\\./\\.\\./?$',
'^\\.\\./\\.\\./\\.\\.(?!/?$)',
],
['^@/types'],
['^'],
],
},
],
},
globals: {
React: 'writable', // Updated to 'writable' to reflect correct usage
JSX: true,
},
};
21 changes: 0 additions & 21 deletions .eslintrc.json

This file was deleted.

15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ jobs:
name: test/node ${{ matrix.node }}/${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- run: npm install
- run: npm run lint
- run: npm run test
- run: npm run build

Expand All @@ -24,11 +26,12 @@ jobs:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '17'
- run: npm install
node-version: '18'
cache: 'npm'
- run: npm ci
- run: npm run build
- uses: paambaati/[email protected]
env:
Expand Down
10 changes: 7 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"semi": true,
"singleQuote": true
}
"trailingComma": "es5",
"semi": true,
"tabWidth": 2,
"singleQuote": true,
"jsxSingleQuote": true,
"plugins": ["prettier-plugin-tailwindcss"]
}
23 changes: 10 additions & 13 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// jest.config.js

module.exports = {
collectCoverageFrom: [
'**/*.{js,jsx,ts,tsx}',
Expand All @@ -9,28 +7,27 @@ module.exports = {
'!*.config.{js,ts}',
],
moduleNameMapper: {
/* Handle CSS imports (with CSS modules)
https://jestjs.io/docs/webpack#mocking-css-modules */
'^.+\\.module\\.(css|sass|scss)$': 'identity-obj-proxy',

// Handle CSS imports (without CSS modules)
'^.+\\.(css|sass|scss)$': '<rootDir>/__mocks__/styleMock.js',

/* Handle image imports
https://jestjs.io/docs/webpack#handling-static-assets */
'^.+\\.(jpg|jpeg|png|gif|webp|avif|svg)$':
'<rootDir>/__mocks__/fileMock.js',
},
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/.next/'],
testEnvironment: 'jsdom',
transform: {
/* Use babel-jest to transpile tests with the next/babel preset
https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object */
'^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { presets: ['next/babel'] }],
},
transformIgnorePatterns: [
'/node_modules/',
'^.+\\.module\\.(css|sass|scss)$',
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js']
}
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
coverageThreshold: {
global: {
branches: 10,
functions: 10,
lines: 10,
statements: 10,
},
},
};
2 changes: 1 addition & 1 deletion jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// jest.setup.js

import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom/extend-expect';
10 changes: 3 additions & 7 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
/** @type {import('next').NextConfig} */


const nextConfig = {
reactStrictMode: false,
swcMinify: true,
trailingSlash: true,
images: {
unoptimized: true
unoptimized: true,
},
}

module.exports = nextConfig


};

module.exports = nextConfig;
Loading

0 comments on commit 534fcfc

Please sign in to comment.