Skip to content

Commit

Permalink
chore(eslint): add some ESlint configuration (#1178)
Browse files Browse the repository at this point in the history
Based on bpmn-visualization configuration:
- Add `eslint-plugin-import` and `eslint-import-resolver-typescript`.
- Update TS configuration
- Add some `@typescript-eslint` rules
  • Loading branch information
csouchet authored Oct 9, 2023
1 parent 27608b3 commit a3145d4
Show file tree
Hide file tree
Showing 134 changed files with 1,242 additions and 1,009 deletions.
35 changes: 34 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
module.exports = {
plugins: ['notice'],
plugins: ['notice', 'import'],
extends: [
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
],
Expand Down Expand Up @@ -44,7 +44,22 @@ module.exports = {
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
'plugin:import/recommended',
'plugin:import/typescript',
],
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
project: './tsconfig.json',
},
},
},
parserOptions: {
// This setting is required if you want to use rules which require type information
// https://typescript-eslint.io/packages/parser/#project
project: ['./tsconfig.json'],
},
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
'@typescript-eslint/explicit-function-return-type': [
Expand All @@ -54,6 +69,24 @@ module.exports = {
allowTypedFunctionExpressions: true,
},
],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public',
},
],
'@typescript-eslint/consistent-type-exports': [
'error',
{
fixMixedExportsWithInlineTypeSpecifier: true,
},
],
'@typescript-eslint/consistent-type-imports': ['error'],
'@typescript-eslint/dot-notation': 'error',
'@typescript-eslint/require-await': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/no-misused-promises': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
},
},
// markdown
Expand Down
1,607 changes: 866 additions & 741 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"babel-plugin-styled-components": "^2.1.4",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-mdx": "^2.2.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-mdx": "^2.2.0",
"eslint-plugin-notice": "^0.9.10",
"eslint-plugin-prettier": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/base/breakpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { BreakpointsOptions } from '@mui/material';
import type { BreakpointsOptions } from '@mui/material';

/**
* To customize the breakpoints: https://mui.com/material-ui/customization/breakpoints/
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/base/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { PaletteOptions, SocialPaletteOptions } from '@mui/material';
import type { PaletteOptions, SocialPaletteOptions } from '@mui/material';

/**
* The base colors for the Material Kit 2 React.
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/base/typography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* You can customize the typography styles for the entire Material Kit 2 React using this file.
*/

import { TypographyOptions } from '@mui/material/styles/createTypography';
import type { TypographyOptions } from '@mui/material/styles/createTypography';

import { fontSize, fontWeight } from '../helpers/font-utils';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/card/muiCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Coded by www.creative-tim.com
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { borders, boxShadows, rgba } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/card/muiCardContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

/**
=========================================================
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/card/muiCardMedia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { borders } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/dialog/muiDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { borders, boxShadows } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/dialog/muiDialogActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

/**
=========================================================
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/dialog/muiDialogContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { fontSize, borders } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/dialog/muiDialogContentText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { fontSize } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/dialog/muiDialogTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { fontSize } from '../..';

Expand Down
6 changes: 2 additions & 4 deletions src/assets/theme/components/form/muiAutocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { borders, boxShadows, dark, darker } from '../..';

import { fontSize } from '../..';
import { borders, boxShadows, dark, darker, fontSize } from '../..';

export const MuiAutocomplete: Components<Theme>['MuiAutocomplete'] = {
styleOverrides: {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/form/muiCheckbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { borders, linearGradient } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/form/muiFormControlLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { dark, fontSize, fontWeight } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/form/muiFormLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { fontSize } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/form/muiInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { dark, fontSize } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/form/muiInputBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { fontSize } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/form/muiInputLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Palette, PaletteColor, Theme } from '@mui/material';
import type { Components, Palette, PaletteColor, Theme } from '@mui/material';

import { fontSize } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/form/muiOutlinedInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { fontSize } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/form/muiRadio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { borders, linearGradient } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/form/muiSelect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

export const MuiSelect: Components<Theme>['MuiSelect'] = {
styleOverrides: {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/form/muiSwitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { borders, boxShadows, darker, linearGradient } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/form/muiTextField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

export const MuiTextField: Components<Theme>['MuiTextField'] = {
styleOverrides: {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/list/muiList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

export const MuiList: Components<Theme>['MuiList'] = {
styleOverrides: {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/list/muiListItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

export const MuiListItem: Components<Theme>['MuiListItem'] = {
defaultProps: {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/list/muiListItemText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

export const MuiListItemText: Components<Theme>['MuiListItemText'] = {
styleOverrides: {
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/menu/muiMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { borders, boxShadows, fontSize } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/menu/muiMenuItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { borders, dark, fontSize } from '../..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/muiAppBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

/**
=========================================================
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/muiAvatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { borders } from '..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/muiBreadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { fontSize } from '..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/muiButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Coded by www.creative-tim.com
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { borders, fontSize, fontWeight } from '..';

Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/muiButtonBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

export const MuiButtonBase: Components<Theme>['MuiButtonBase'] = {
defaultProps: {
Expand Down
4 changes: 2 additions & 2 deletions src/assets/theme/components/muiContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Breakpoint, Components, Theme } from '@mui/material';
import { OverridesStyleRules } from '@mui/material/styles/overrides';
import type { Breakpoint, Components, Theme } from '@mui/material';
import type { OverridesStyleRules } from '@mui/material/styles/overrides';

// Material Kit 2 React base styles
import { breakpoints } from '../base/breakpoints';
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/muiCssBaseline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

export const MuiCssBaseline: Components<Theme>['MuiCssBaseline'] = {
styleOverrides: ({ palette }) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/assets/theme/components/muiDivider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*/

import { Components, Theme } from '@mui/material';
import type { Components, Theme } from '@mui/material';

import { dark, rgba } from '..';

Expand Down
Loading

0 comments on commit a3145d4

Please sign in to comment.