Skip to content

Commit

Permalink
Merge pull request #154 from BootNodeDev/feat/#151
Browse files Browse the repository at this point in the history
chore: add ESLINT rules to avoid the use of the React namespace
  • Loading branch information
gabitoesmiapodo authored Jul 5, 2024
2 parents 8425c69 + 0b269b2 commit 3be1bf6
Show file tree
Hide file tree
Showing 43 changed files with 329 additions and 220 deletions.
49 changes: 39 additions & 10 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:import/recommended',
'plugin:eslint-plugin-jsx-a11y/recommended',
'prettier',
],
ignorePatterns: ['dist', '.eslintrc.cjs', '**/*.css', '**/*.scss', '**/*.html'],
settings: {
react: {
Expand All @@ -22,6 +12,16 @@ module.exports = {
},
},
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:import/recommended',
'plugin:eslint-plugin-jsx-a11y/recommended',
'prettier',
],
plugins: ['react-refresh', 'sort-destructure-keys', 'no-relative-import-paths'],
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
Expand All @@ -45,6 +45,35 @@ module.exports = {
pathGroupsExcludedImportTypes: ['builtin'],
},
],
'import/named': 'error',
'import/no-unresolved': 'error',
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'react',
importNames: ['default'],
message: 'Import React specifically, not as the default export.',
},
],
},
],
'no-restricted-syntax': [
'error',
{
selector: 'MemberExpression[object.name="React"][property.name!="default"]',
message: 'Use named imports from "react" instead of React.<property>',
},
],
'no-restricted-globals': [
'error',
{
name: 'React',
message:
'Do not use React as a global variable. Import necessary hooks and components individually.',
},
],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'no-use-before-define': 'off',
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"next-themes": "^0.3.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hot-toast": "^2.4.1",
"react-error-boundary": "^4.0.13",
"react-hot-toast": "^2.4.1",
"react-jazzicon": "^1.0.4",
"styled-components": "^6.1.11",
"use-debounce": "^10.0.1",
Expand Down Expand Up @@ -73,19 +73,19 @@
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-no-relative-import-paths": "^1.5.4",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-no-relative-import-paths": "^1.5.5",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-react-refresh": "^0.4.7",
"eslint-plugin-sort-destructure-keys": "^2.0.0",
"husky": "^9.0.11",
"jsdom": "^24.1.0",
"lint-staged": "^15.2.2",
"lint-staged": "^15.2.7",
"postcss-styled-syntax": "^0.6.4",
"prettier": "^3.2.5",
"stylelint": "^16.5.0",
"stylelint-config-standard": "^36.0.0",
"prettier": "^3.3.2",
"stylelint": "^16.6.1",
"stylelint-config-standard": "^36.0.1",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vitest": "^1.6.0"
Expand Down
Loading

0 comments on commit 3be1bf6

Please sign in to comment.