Skip to content

Commit

Permalink
fix: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
davidecarpini committed Oct 24, 2024
1 parent 2e1d9ac commit ce713e9
Show file tree
Hide file tree
Showing 45 changed files with 227 additions and 396 deletions.
28 changes: 14 additions & 14 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import globals from 'globals';
import tseslint from 'typescript-eslint';
import pluginReact from 'eslint-plugin-react';

export default [
{ languageOptions: { globals: globals.browser } },
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
rules: {
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'import/no-default-export': 'off',
},
export default tseslint.config({
ignores: ['**/*.config.ts', 'dist/**'],
extends: [...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'no-console': ['error', { allow: ['error'] }],
'eslint-comments/no-unused-disable': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
],
},
];
});
8 changes: 0 additions & 8 deletions examples/sample-angular-app/eslint.config.mjs

This file was deleted.

1 change: 0 additions & 1 deletion examples/sample-angular-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"clean": "rm -rf dist .turbo .angular",
"dev": "ng serve --port 5004",
"gh-pages-build": "ng build --configuration development --base-href '/vechain-dapp-kit/angular/'",
"lint": "eslint",
"preview": "ng serve --port 5004",
"purge": "yarn clean; rm -rf node_modules",
"watch": "ng build --watch --configuration development"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable @typescript-eslint/no-unsafe-assignment
// eslint-disable @typescript-eslint/no-unsafe-member-access
// Packages
import packageInfo from '../../package.json';

Expand All @@ -12,7 +11,6 @@ const baseUrl = scheme + host + port + path;

export const environment = {
production: true,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
version: packageInfo.version,
appName: 'EasyAngular',
envName: 'prod',
Expand Down
2 changes: 0 additions & 2 deletions examples/sample-angular-app/src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable @typescript-eslint/no-unsafe-assignment
// eslint-disable @typescript-eslint/no-unsafe-member-access
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
Expand All @@ -18,7 +17,6 @@ const baseUrl = scheme + host + port + path;

export const environment = {
production: false,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
version: packageInfo.version,
appName: 'EasyAngular',
envName: 'local',
Expand Down
1 change: 0 additions & 1 deletion examples/sample-angular-app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ import { AppComponent } from './app/app.component';

bootstrapApplication(AppComponent, {
providers: [],
// eslint-disable-next-line no-console
}).catch((err) => console.error(err));
3 changes: 1 addition & 2 deletions examples/sample-angular-app/src/polyfills.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
Expand Down Expand Up @@ -55,6 +53,7 @@ import 'zone.js'; // Included with Angular CLI.

import '@angular/localize/init';
(window as any).global = window;
// eslint-disable-next-line @typescript-eslint/no-require-imports
global.Buffer = global.Buffer || require('buffer').Buffer;
(window as any).process = {
env: { DEBUG: undefined },
Expand Down
2 changes: 0 additions & 2 deletions examples/sample-next-app/.eslintignore

This file was deleted.

2 changes: 1 addition & 1 deletion examples/sample-next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint": "^9.12.0",
"eslint-config-next": "14.1.4",
"typescript": "5.3.3"
}
Expand Down
33 changes: 14 additions & 19 deletions examples/sample-react-app/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
export default {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
],
globals: {
JSX: true,
},
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
import tseslint from 'typescript-eslint';

export default tseslint.config({
ignores: ['**/*.config.ts', 'dist/**'],
extends: [...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'no-console': ['error', { allow: ['error'] }],
'eslint-comments/no-unused-disable': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' },
],
'react/react-in-jsx-scope': 'off',
},
};
});
2 changes: 1 addition & 1 deletion examples/sample-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@vitejs/plugin-react": "^4.2.0",
"eslint": "^8.53.0",
"eslint": "^9.12.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.4",
"react-test-renderer": "^18.2.0",
Expand Down
77 changes: 0 additions & 77 deletions examples/sample-remix-app/eslint.config.mjs

This file was deleted.

3 changes: 1 addition & 2 deletions examples/sample-remix-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"build": "remix vite:build --mode=development",
"dev": "remix vite:dev",
"gh-pages-build": "remix vite:build",
"lint": "eslint",
"preview": "PORT=5007 remix-serve ./build/server/index.js",
"typecheck": "tsc"
},
Expand All @@ -29,7 +28,7 @@
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"eslint": "^8.38.0",
"eslint": "^9.12.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
Expand Down
14 changes: 0 additions & 14 deletions examples/sample-svelte-app/.eslintignore

This file was deleted.

2 changes: 1 addition & 1 deletion examples/sample-svelte-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@sveltejs/kit": "^1.27.4",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"eslint": "^8.28.0",
"eslint": "^9.12.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-svelte": "^2.30.0",
"prettier": "^3.0.0",
Expand Down
1 change: 0 additions & 1 deletion examples/sample-svelte-app/svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ const config = {
},
};

// eslint-disable-next-line import/no-default-export
export default config;
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@
"@changesets/cli": "^2.27.1",
"@commitlint/config-conventional": "^18.0.0",
"commitlint": "^18.0.0",
"eslint": "^8.4.1",
"eslint": "^9.12.0",
"typescript-eslint": "^8.11.0",
"eslint-plugin-prefer-arrow": "1.2.3",
"husky": "^8.0.0",
"lint-staged": "^15.0.2",
"prettier": "^2.5.1",
"punycode": "^1.4.1",
"turbo": "latest",
"typescript": "4.9.5",
"typescript-eslint": "^8.11.0"
"typescript": "4.9.5"
},
"packageManager": "[email protected]"
}
8 changes: 0 additions & 8 deletions packages/dapp-kit-react/.eslintignore

This file was deleted.

58 changes: 12 additions & 46 deletions packages/dapp-kit-react/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,51 +1,17 @@
import { resolve } from 'node:path';
import tseslint from 'typescript-eslint';

const project = resolve(process.cwd(), 'tsconfig.json');

export default {
extends: [
'@vercel/style-guide/eslint/browser',
'@vercel/style-guide/eslint/typescript',
'@vercel/style-guide/eslint/react',
],
parserOptions: {
project,
ecmaVersion: 'latest',
sourceType: 'module',
},
parser: '@typescript-eslint/parser',
globals: {
JSX: true,
},
settings: {
'import/resolver': {
typescript: {
project,
},
},
},
ignorePatterns: [
'node_modules/',
'dist/',
'.eslintrc.js',
'**/*.css',
'*.test.ts',
'test/**',
],
// add rules configurations here
export default tseslint.config({
ignores: ['**/*.config.ts', 'dist/**'],
extends: [...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
rules: {
'import/no-default-export': 'off',
'unicorn/filename-case': 'off',
'react-hooks/exhaustive-deps': 'error',
'react/function-component-definition': [
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'no-console': ['error', { allow: ['error'] }],
'eslint-comments/no-unused-disable': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
namedComponents: 'arrow-function',
unnamedComponents: 'arrow-function',
},
{ argsIgnorePattern: '^_' },
],
'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
'func-style': ['error', 'expression', { allowArrowFunctions: true }],
'@typescript-eslint/ban-ts-comment': 'off',
},
};
});
2 changes: 1 addition & 1 deletion packages/dapp-kit-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@testing-library/react": "^14.1.2",
"@types/react": "^18.2.28",
"@types/react-dom": "^18.2.13",
"eslint": "^8.15.0",
"eslint": "^9.12.0",
"react": "^18.2.0",
"tsup": "*",
"typescript": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,5 @@ export const getAddress = async ({
decoded: { addresses },
} = res;

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return (addresses?.[0] as string) || null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,5 @@ export const getDomain = async ({
decoded: { names },
} = res;

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return (names?.[0] as string) || null;
};
Loading

0 comments on commit ce713e9

Please sign in to comment.