forked from twentyhq/twenty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add linter to Chrome Extension (twentyhq#4044). (twentyhq#4174)
* feat: configure eslint rules by replicating those in the twenty-front package and introduce scripts for linting, formatting code and removing build output * fix: ensure each file of the extension package satisfies linting rules and disable some rules where necessary * fix: update relative imports to absolute imports throughout extension code with the defined tilde and at symbols * fix: import the updated ui module from the front package to the chrome extension package to prevent eslint rules from breaking subject to the recent merged changes into main * fix: commit the case change for files that were missed by Git in the earlier commits due to default configuration
- Loading branch information
1 parent
8dd06bd
commit c274d35
Showing
67 changed files
with
783 additions
and
567 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
extends: ['./.eslintrc.cjs'], | ||
rules: { | ||
'no-console': 'error', | ||
}, | ||
overrides: [ | ||
{ | ||
files: [ | ||
'.storybook/**/*', | ||
'**/*.stories.tsx', | ||
'**/*.test.ts', | ||
'**/*.test.tsx', | ||
], | ||
rules: { | ||
'no-console': 'off', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,61 @@ | ||
// eslint-disable-next-line | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:@nx/react', | ||
'plugin:react/recommended', | ||
'plugin:react-hooks/recommended', | ||
'plugin:storybook/recommended', | ||
'../../.eslintrc.js', | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
plugins: ['react-hooks', 'react-refresh'], | ||
ignorePatterns: ['!**/*', 'node_modules', 'dist'], | ||
rules: { | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
'@nx/workspace-effect-components': 'error', | ||
'@nx/workspace-no-hardcoded-colors': 'error', | ||
'@nx/workspace-matching-state-variable': 'error', | ||
'@nx/workspace-sort-css-properties-alphabetically': 'error', | ||
'@nx/workspace-styled-components-prefixed-with-styled': 'error', | ||
'@nx/workspace-no-state-useref': 'error', | ||
'@nx/workspace-component-props-naming': 'error', | ||
|
||
'react/no-unescaped-entities': 'off', | ||
'react/prop-types': 'off', | ||
'react/jsx-key': 'off', | ||
'react/display-name': 'off', | ||
'react/jsx-uses-react': 'off', | ||
'react/react-in-jsx-scope': 'off', | ||
'react/jsx-no-useless-fragment': 'off', | ||
'react/jsx-props-no-spreading': [ | ||
'error', | ||
{ | ||
explicitSpread: 'ignore', | ||
}, | ||
], | ||
}, | ||
} | ||
overrides: [ | ||
{ | ||
files: ['*.ts', '*.tsx', '*.js', '*.jsx'], | ||
parserOptions: { | ||
project: ['packages/twenty-chrome-extension/tsconfig.*?.json'], | ||
}, | ||
rules: {}, | ||
}, | ||
{ | ||
files: ['.storybook/main.@(js|cjs|mjs|ts)'], | ||
rules: { | ||
'storybook/no-uninstalled-addons': [ | ||
'error', | ||
{ packageJsonLocation: path.resolve('../../package.json') }, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['.storybook/**/*', '**/*.stories.tsx', '**/*.test.@(ts|tsx)'], | ||
rules: { | ||
'no-console': 'off', | ||
}, | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ages/twenty-chrome-extension/src/options/modules/ui/theme/components/AppThemeProvider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/twenty-chrome-extension/src/options/modules/ui/theme/constants/AccentDark.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { COLOR } from '@/ui/theme/constants/Colors'; | ||
|
||
export const ACCENT_DARK = { | ||
primary: COLOR.blueAccent75, | ||
secondary: COLOR.blueAccent80, | ||
tertiary: COLOR.blueAccent85, | ||
quaternary: COLOR.blueAccent90, | ||
accent3570: COLOR.blueAccent70, | ||
accent4060: COLOR.blueAccent60, | ||
}; |
10 changes: 10 additions & 0 deletions
10
packages/twenty-chrome-extension/src/options/modules/ui/theme/constants/AccentLight.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { COLOR } from '@/ui/theme/constants/Colors'; | ||
|
||
export const ACCENT_LIGHT = { | ||
primary: COLOR.blueAccent25, | ||
secondary: COLOR.blueAccent20, | ||
tertiary: COLOR.blueAccent15, | ||
quaternary: COLOR.blueAccent10, | ||
accent3570: COLOR.blueAccent35, | ||
accent4060: COLOR.blueAccent40, | ||
}; |
9 changes: 9 additions & 0 deletions
9
packages/twenty-chrome-extension/src/options/modules/ui/theme/constants/Animation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const ANIMATION = { | ||
duration: { | ||
instant: 0.075, | ||
fast: 0.15, | ||
normal: 0.3, | ||
}, | ||
}; | ||
|
||
export type AnimationDuration = 'instant' | 'fast' | 'normal'; |
26 changes: 26 additions & 0 deletions
26
packages/twenty-chrome-extension/src/options/modules/ui/theme/constants/BackgroundDark.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable @nx/workspace-no-hardcoded-colors */ | ||
import DarkNoise from '@/ui/theme/assets/dark-noise.jpg'; | ||
import { COLOR } from '@/ui/theme/constants/Colors'; | ||
import { GRAY_SCALE } from '@/ui/theme/constants/GrayScale'; | ||
import { RGBA } from '@/ui/theme/constants/Rgba'; | ||
|
||
export const BACKGROUND_DARK = { | ||
noisy: `url(${DarkNoise.toString()});`, | ||
primary: GRAY_SCALE.gray85, | ||
secondary: GRAY_SCALE.gray80, | ||
tertiary: GRAY_SCALE.gray75, | ||
quaternary: GRAY_SCALE.gray70, | ||
danger: COLOR.red80, | ||
transparent: { | ||
primary: RGBA(GRAY_SCALE.gray85, 0.8), | ||
secondary: RGBA(GRAY_SCALE.gray80, 0.8), | ||
strong: RGBA(GRAY_SCALE.gray0, 0.14), | ||
medium: RGBA(GRAY_SCALE.gray0, 0.1), | ||
light: RGBA(GRAY_SCALE.gray0, 0.06), | ||
lighter: RGBA(GRAY_SCALE.gray0, 0.03), | ||
danger: RGBA(COLOR.red, 0.08), | ||
}, | ||
overlay: RGBA(GRAY_SCALE.gray80, 0.8), | ||
radialGradient: `radial-gradient(50% 62.62% at 50% 0%, #505050 0%, ${GRAY_SCALE.gray60} 100%)`, | ||
radialGradientHover: `radial-gradient(76.32% 95.59% at 50% 0%, #505050 0%, ${GRAY_SCALE.gray60} 100%)`, | ||
}; |
Oops, something went wrong.