Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: eslint rules around imports #92

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.16.0
v20.8.1
35 changes: 35 additions & 0 deletions auditjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,38 @@
}
]
},
{
"coordinates": "pkg:npm/[email protected]",
"description": "Promise based HTTP client for the browser and node.js",
"reference": "https://ossindex.sonatype.org/component/pkg:npm/[email protected]?utm_source=auditjs&utm_medium=integration&utm_content=4.0.41",
"vulnerabilities": [
{
"id": "CVE-2023-45857",
"title": "[CVE-2023-45857] CWE-352: Cross-Site Request Forgery (CSRF)",
"description": "axios - Cross-Site Request Forgery (CSRF)",
"cvssScore": 6.8,
"cvssVector": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N",
"cve": "CVE-2023-45857",
"reference": "https://ossindex.sonatype.org/vulnerability/CVE-2023-45857?component-type=npm&component-name=axios&utm_source=auditjs&utm_medium=integration&utm_content=4.0.41"
}
]
},
{
"coordinates": "pkg:npm/[email protected]",
"description": "Promise based HTTP client for the browser and node.js",
"reference": "https://ossindex.sonatype.org/component/pkg:npm/[email protected]?utm_source=auditjs&utm_medium=integration&utm_content=4.0.41",
"vulnerabilities": [
{
"id": "CVE-2023-45857",
"title": "[CVE-2023-45857] CWE-352: Cross-Site Request Forgery (CSRF)",
"description": "axios - Cross-Site Request Forgery (CSRF)",
"cvssScore": 6.8,
"cvssVector": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N",
"cve": "CVE-2023-45857",
"reference": "https://ossindex.sonatype.org/vulnerability/CVE-2023-45857?component-type=npm&component-name=axios&utm_source=auditjs&utm_medium=integration&utm_content=4.0.41"
}
]
},
{
"coordinates": "pkg:npm/[email protected]",
"description": "Tool for transforming styles with JS plugins",
Expand Down Expand Up @@ -1485,6 +1517,9 @@
{
"id": "CVE-2022-25883"
},
{
"id": "CVE-2023-45857"
},
{
"id": "CVE-2023-44270"
}
Expand Down
196 changes: 105 additions & 91 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@
"@emotion/eslint-plugin": "^11.11.0",
"@nx/eslint-plugin": "^16.5.0",
"@tablecheck/eslint-plugin": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-prettier": "^9.0.0",
"eslint-formatter-pretty": "^5.0.0",
"eslint-import-resolver-babel-module": "^5.3.2",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-cypress": "^2.13.3",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-cypress": "^2.15.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"fs-extra": "^11.1.1",
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config/src/overrides/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ export const documentationOverrides: Linter.ConfigOverride = {
'react-hooks/exhaustive-deps': 'off',
'react/function-component-definition': 'off',
'react/jsx-no-constructed-context-values': 'off',
'react-refresh/only-export-components': 'off',
},
};
1 change: 1 addition & 0 deletions packages/eslint-config/src/overrides/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const testOverrides: Linter.ConfigOverride = {
'prefer-promise-reject-errors': 'off',
'global-require': 'off',
'react/prop-types': 'off',
'react-refresh/only-export-components': 'off',

'jsx-a11y/accessible-emoji': 'off',
'jsx-a11y/alt-text': 'off',
Expand Down
2 changes: 2 additions & 0 deletions packages/eslint-config/src/overrides/typescriptTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const typescriptTestsOverrides = typescriptOverrides
// here we use the more lenient consistent-return to help prevent weird errors
'@typescript-eslint/explicit-module-boundary-types': 'off',
'consistent-return': 'error',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
},
env: {
node: true,
Expand Down
4 changes: 4 additions & 0 deletions packages/eslint-config/src/rules/namingConvention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ export const namingRules: Linter.RulesRecord = {
types: ['function'],
format: ['PascalCase', 'camelCase'],
},
{
selector: 'import',
format: ['PascalCase', 'camelCase', 'UPPER_CASE'],
},
{
selector: ['function', 'classMethod', 'objectLiteralMethod'],
format: ['PascalCase', 'camelCase'],
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/src/rules/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const reactRules: Linter.RulesRecord = {
'react/jsx-no-useless-fragment': ['error', { allowExpressions: true }],
'@tablecheck/consistent-react-import': 'error',
'react-refresh/only-export-components': [
'error',
'warn',
{ allowConstantExport: true },
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import {
const ruleTester = new RuleTester({
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.test.json',
project: './fixtures/tsconfig.test.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
});

const filename = './test_src/default.tsx';
const filename = './fixtures/test_src/default.tsx';
const invalidTests = [
{
code: `import { useState } from 'react';const [val, setVal] = useState(true);`,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../../../../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "../",
"baseUrl": ".",
"paths": {
"~/*": ["./*"]
}
},
"include": ["**/*.ts", "*.tsx"],
"exclude": ["node_modules"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "./test_src",
"baseUrl": "./test_src"
},
"include": ["test_src/**/*.ts", "test_src/*.tsx"],
"exclude": ["node_modules"]
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../../tsconfig.base.json",
"extends": "../../../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "./test_src",
"baseUrl": "./test_src",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"rootDir": "./test_src",
"baseUrl": "./test_src",
"paths": {
"~/*": ["./test_src/*"]
}
},
"include": ["test_src/**/*.ts", "test_src/*.tsx"],
"exclude": ["node_modules"]
}
4 changes: 2 additions & 2 deletions packages/eslint-plugin/__tests__/forbiddenImports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { forbiddenImports as rule, messageId } from '../src/forbiddenImports';
const ruleTester = new RuleTester({
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.test.json',
project: './fixtures/tsconfig.test.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
});

const filename = './test_src/default.tsx';
const filename = './fixtures/test_src/default.tsx';

ruleTester.run('forbiddenImports > valid other import formats', rule, {
valid: [
Expand Down
Loading
Loading