Skip to content

Commit

Permalink
Merge pull request #16 from nginformatica/feat/update-eslint
Browse files Browse the repository at this point in the history
feat/update eslint
  • Loading branch information
KarineBrandelli authored Nov 12, 2024
2 parents 472b550 + eb90953 commit ddca517
Show file tree
Hide file tree
Showing 6 changed files with 1,607 additions and 2,497 deletions.
97 changes: 54 additions & 43 deletions .eslintrc.js → eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
const react = require('eslint-plugin-react')
const parser = require('@typescript-eslint/parser')
const tseslint = require('typescript-eslint')
const stylistic = require('@stylistic/eslint-plugin')
const importplugin = require('eslint-plugin-import')
const eslintprettier = require('eslint-plugin-prettier')
const tseslintplugin = require('@typescript-eslint/eslint-plugin')

const rulesReact = {
'react/prop-types': 'off',
'react/display-name': 'off',
Expand Down Expand Up @@ -95,11 +103,6 @@ const rulesImport = {
group: 'external',
position: 'before'
},
{
pattern: 'react-dom/**',
group: 'external',
position: 'before'
},
{
pattern: 'styled-components',
group: 'external',
Expand All @@ -126,7 +129,7 @@ const rulesImport = {
position: 'after'
}
],
pathGroupsExcludedImportTypes: ['react', 'react-dom'],
pathGroupsExcludedImportTypes: ['react'],
'newlines-between': 'never',
alphabetize: {
order: 'asc',
Expand All @@ -149,7 +152,6 @@ const rulesTypescript = {
'@typescript-eslint/prefer-optional-chain': 'warn',
'@typescript-eslint/restrict-plus-operands': 'warn',
'@typescript-eslint/no-unnecessary-condition': 'warn',
'@typescript-eslint/switch-exhaustiveness-check': 'warn',
'@typescript-eslint/prefer-reduce-type-parameter': 'warn',
'@typescript-eslint/no-unnecessary-type-constraint': 'warn',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
Expand All @@ -161,43 +163,52 @@ const rulesTypescript = {
'@typescript-eslint/consistent-type-imports': 'error'
}

module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true
},
sourceType: 'module',
project: ['./tsconfig.json']
module.exports = tseslint.config(
...tseslint.configs.recommended,
{
ignores: [
'docs/*',
'node_modules/*',
'eslint.config.js'
]
},
settings: {
react: {
version: 'detect'
{
files: ['src/**/*.{ts,tsx}'],
languageOptions: {
parser: parser,
parserOptions: {
ecmaFeatures: {
jsx: true
},
projectService: true
},
ecmaVersion: 'latest',
sourceType: 'module'
},
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx']
settings: {
react: {
version: 'detect'
},
'import/parsers': {
tsParser: ['.ts', '.tsx']
},
'import/resolver': {
typescript: true
}
},
plugins: {
react: react,
import: importplugin,
prettier: eslintprettier,
'@stylistic': stylistic,
'@typescript-eslint': tseslintplugin
},
'import/resolver': {
typescript: true
rules: {
'prettier/prettier': 'error',
...rulesReact,
...rulesEslint,
...rulesImport,
...rulesTypescript
}
},
extends: [
'eslint:recommended',
'plugin:react/jsx-runtime',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:prettier/recommended',
'prettier'
],
rules: {
'prettier/prettier': 'error',
...rulesReact,
...rulesEslint,
...rulesImport,
...rulesTypescript
},
plugins: ['@typescript-eslint', 'import', '@stylistic'],
ignorePatterns: ['.eslintrc.js']
}
}
)
53 changes: 27 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ng-design-system",
"version": "1.0.8",
"version": "1.0.9",
"description": "The Design System for the NG Saas Products",
"author": "NG",
"license": "MIT",
Expand All @@ -9,44 +9,45 @@
"type-check": "tsc --noEmit",
"docs:build": "storybook build -o docs",
"format": "prettier -w 'src/**/*.{ts,tsx}'",
"lint": "eslint -c .eslintrc.js 'src/**/*.{ts,tsx}'",
"lint:fix": "eslint -c .eslintrc.js --fix 'src/**/*.{ts,tsx}'",
"lint:quiet": "eslint --quiet .eslintrc.js 'src/**/*.{ts,tsx}'"
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:quiet": "eslint . --quiet"
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "7.25.7",
"@babel/core": "7.25.7",
"@babel/plugin-transform-runtime": "7.25.7",
"@babel/preset-env": "7.25.7",
"@babel/preset-react": "7.25.7",
"@babel/preset-typescript": "7.25.7",
"@storybook/addon-essentials": "8.3.4",
"@babel/cli": "7.25.9",
"@babel/core": "7.26.0",
"@babel/plugin-transform-runtime": "7.25.9",
"@babel/preset-env": "7.26.0",
"@babel/preset-react": "7.25.9",
"@babel/preset-typescript": "7.26.0",
"@storybook/addon-essentials": "8.4.2",
"@storybook/addon-webpack5-compiler-babel": "3.0.3",
"@storybook/blocks": "8.3.4",
"@storybook/react": "8.3.4",
"@storybook/react-webpack5": "8.3.4",
"@stylistic/eslint-plugin": "2.8.0",
"@types/react": "18.3.11",
"@types/react-dom": "18.3.0",
"@typescript-eslint/eslint-plugin": "8.8.0",
"@typescript-eslint/parser": "8.8.0",
"amazing-react-charts": "1.1.2",
"@storybook/blocks": "8.4.2",
"@storybook/react": "8.4.2",
"@storybook/react-webpack5": "8.4.2",
"@stylistic/eslint-plugin": "2.10.1",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@typescript-eslint/eslint-plugin": "8.14.0",
"@typescript-eslint/parser": "8.14.0",
"amazing-react-charts": "1.1.7",
"babel-loader": "9.2.1",
"babel-plugin-import": "1.13.8",
"eslint": "8.57.0",
"eslint": "9.14.0",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-typescript": "3.6.3",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react": "7.37.1",
"flipper-ui": "0.34.7",
"eslint-plugin-react": "7.37.2",
"flipper-ui": "0.35.0",
"prettier": "3.3.3",
"react": "18.3.1",
"react-dom": "18.3.1",
"storybook": "8.3.4",
"storybook": "8.4.2",
"styled-components": "6.1.13",
"typescript": "5.6.2",
"webpack": "5.95.0"
"typescript": "5.6.3",
"typescript-eslint": "8.14.0",
"webpack": "5.96.1"
}
}
11 changes: 11 additions & 0 deletions src/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
declare module '*.png' {
const value: string

export default value
}

declare module '*.svg' {
const value: string

export default value
}
2 changes: 1 addition & 1 deletion src/docs/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const Wrapper = styled.div`
width: 100vw;
height: 100vh;
padding: 3rem;
background: url(${bg}) no-repeat center center fixed;
background: url(${bg as string}) no-repeat center center fixed;
background-size: cover;
`

Expand Down
2 changes: 0 additions & 2 deletions src/index.d.ts

This file was deleted.

Loading

0 comments on commit ddca517

Please sign in to comment.