Skip to content

Commit

Permalink
import eslint config (#228)
Browse files Browse the repository at this point in the history
* import eslint config

* feat: import penumbra config and ignore current errors and warnings

* feat: fix configs version

* feat: configs on npm

* feat: configs on npm

* fix: missing package

---------

Co-authored-by: Atris <vacekj@outlook.com>
  • Loading branch information
TalDerei and vacekj authored Dec 1, 2024
1 parent a79ce04 commit 23f6d3f
Show file tree
Hide file tree
Showing 13 changed files with 689 additions and 780 deletions.
73 changes: 62 additions & 11 deletions apps/extension/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,64 @@
import { penumbraEslintConfig } from '@repo/eslint-config';
import { config, parser } from 'typescript-eslint';

export default config({
...penumbraEslintConfig,
languageOptions: {
parser,
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
import eslintConfig from '@penumbra-zone/configs/eslint';

export default [
...eslintConfig,
{
name: 'custom-local-ignores',
rules: {
// Existing disabled rules
'no-nested-ternary': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',

// Chrome-related deprecation warnings
'@typescript-eslint/no-deprecated': 'off',

// React Hooks warnings
'react-hooks/exhaustive-deps': 'off',

// Global object usage
'no-restricted-globals': 'off',

// Fragment usage
'react/jsx-no-useless-fragment': 'off',

// Parameter reassignment
'no-param-reassign': 'off',

// Import duplicates
'import/no-duplicates': 'off',

// Unused vars and expressions
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unused-expressions': 'off',

// Await and promise-related rules
'@typescript-eslint/await-thenable': 'off',
'no-promise-executor-return': 'off',

// Type parameter rules
'@typescript-eslint/no-unnecessary-type-parameters': 'off',
'@typescript-eslint/no-duplicate-type-constituents': 'off',

// Switch exhaustiveness
'@typescript-eslint/switch-exhaustiveness-check': 'off',

// Console statements
'no-console': 'off',

// Comment formatting
'spaced-comment': 'off',
'@eslint-community/eslint-comments/require-description': 'off',

// Catch callback type
'@typescript-eslint/use-unknown-in-catch-callback-variable': 'off',

// Global definition (for tests)
'no-undef': 'off',
},
settings: {
react: {
version: 'detect',
},
},
},
});
];
1 change: 1 addition & 0 deletions apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.1.2",
"dotenv": "^16.4.5",
"eslint": "^9.16.0",
"html-webpack-plugin": "^5.6.0",
"postcss": "^8.4.45",
"postcss-loader": "^8.1.1",
Expand Down
7 changes: 5 additions & 2 deletions docs/guiding-principles.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ CI/CD pipeline `/.github/workflows` should actively enforce the best practices:
- [Vitest](https://vitest.dev/) for unit testing
- [Turborepo](https://turbo.build/) for builds

It should not be possible to ship code that hasn't gone through the fire. Further, the use of `eslint` with quite high standards ([packages/eslint-config-custom/index.js](../packages/eslint-config-custom/index.js)) is necessary to keep the codebase
It should not be possible to ship code that hasn't gone through the fire. Further, the use of `eslint`
with [quite high standards](https://github.com/penumbra-zone/web/tree/main/packages/configs) is necessary to keep the
codebase
code quality high. See [CI/CD guide](ci-cd.md) for running commands locally.

## Modularity from the beginning
Expand All @@ -34,5 +36,6 @@ that can make developing further apps easier.

We should attempt to _document as we go_. That should commonly come in two forms:

1. **Code comments** - When there is code that starts to require domain knowledge to understand, we should be quite liberal about adding in-line code comments to explain variables, functions, decisions, etc.
1. **Code comments** - When there is code that starts to require domain knowledge to understand, we should be quite
liberal about adding in-line code comments to explain variables, functions, decisions, etc.
2. **Architecture docs** - This directory holds the documentation on larger technical decisions and system designs.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"devDependencies": {
"@changesets/cli": "^2.27.8",
"@repo/eslint-config": "workspace:*",
"@penumbra-zone/configs": "1.1.0",
"@repo/tailwind-config": "workspace:*",
"@repo/tsconfig": "workspace:*",
"@storybook/react-vite": "8.2.9",
Expand All @@ -50,6 +50,7 @@
"tsx": "^4.19.0",
"turbo": "^2.1.1",
"typescript": "^5.5.4",
"typescript-eslint": "^8.16.0",
"vitest": "1.x"
}
}
14 changes: 2 additions & 12 deletions packages/context/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
import { penumbraEslintConfig } from '@repo/eslint-config';
import { config, parser } from 'typescript-eslint';
import eslintConfig from '@penumbra-zone/configs/eslint';

export default config({
...penumbraEslintConfig,
languageOptions: {
parser,
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
});
export default eslintConfig;
19 changes: 0 additions & 19 deletions packages/eslint-config/CHANGELOG.md

This file was deleted.

99 changes: 0 additions & 99 deletions packages/eslint-config/eslint.config.mjs

This file was deleted.

26 changes: 0 additions & 26 deletions packages/eslint-config/package.json

This file was deleted.

14 changes: 2 additions & 12 deletions packages/noble/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
import { penumbraEslintConfig } from '@repo/eslint-config';
import { config, parser } from 'typescript-eslint';
import eslintConfig from '@penumbra-zone/configs/eslint';

export default config({
...penumbraEslintConfig,
languageOptions: {
parser,
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
});
export default eslintConfig;
2 changes: 1 addition & 1 deletion packages/noble/src/sequence-search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const _getNextSequence = async ({
case NobleRegistrationResponse.Success:
// This means the midpoint had a deposit in it waiting for registration.
// This will "flush" this unregistered address, however the user still wants a new one, so continue the search
// eslint-disable-next-line no-fallthrough
// eslint-disable-next-line no-fallthrough -- see above
case NobleRegistrationResponse.AlreadyRegistered:
// The midpoint has been registered already, search the right-hand side
return _getNextSequence({
Expand Down
1 change: 0 additions & 1 deletion packages/ui/components/ui/separator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
export const Separator = () => (
// For some reason, Tailwind's ESLint config wants to change `border-b-[1px]`
// to `border-b-DEFAULT`, even though that has a different effect!
// eslint-disable-next-line tailwindcss/no-unnecessary-arbitrary-value
<div className='mx-2 h-px min-w-8 grow border-b-[1px] border-dotted border-light-brown' />
);
56 changes: 45 additions & 11 deletions packages/ui/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
import { penumbraEslintConfig } from '@repo/eslint-config';
import { config, parser } from 'typescript-eslint';

export default config({
...penumbraEslintConfig,
languageOptions: {
parser,
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
import eslintConfig from '@penumbra-zone/configs/eslint';

export default [
...eslintConfig,
{
name: 'custom-local-ignores',
rules: {
// Existing disabled rules
'no-nested-ternary': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',

// Fragment-related rules
'react/jsx-no-useless-fragment': 'off',

// Parameter reassignment
'no-param-reassign': 'off',

// Comment formatting and descriptions
'@eslint-community/eslint-comments/require-description': 'off',
'spaced-comment': 'off',

// Tailwind CSS rules
'tailwindcss/no-unnecessary-arbitrary-value': 'off',

// Bitwise operations
'no-bitwise': 'off',

// React Hooks dependencies
'react-hooks/exhaustive-deps': 'off',

// Switch exhaustiveness
'@typescript-eslint/switch-exhaustiveness-check': 'off',

// Deprecation warnings
'@typescript-eslint/no-deprecated': 'off',

// Type conversion and string representation
'@typescript-eslint/no-base-to-string': 'off',
},
settings: {
// Add React version to prevent the warning
react: {
version: 'detect',
},
},
},
});
];
Loading

0 comments on commit 23f6d3f

Please sign in to comment.