@layerzerolabs/eslint-configuration 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/base.js CHANGED
@@ -1,13 +1,12 @@
1
- const typescriptEslint = require('@typescript-eslint/eslint-plugin');
2
- const onlyWarn = require('eslint-plugin-only-warn');
3
- const simpleImportSort = require('eslint-plugin-simple-import-sort');
4
- const tsParser = require('@typescript-eslint/parser');
5
- const globals = require('globals');
6
- const espree = require('espree');
7
- const js = require('@eslint/js');
8
- const turboConfigModule = require('eslint-config-turbo/flat');
9
- const turboConfig = turboConfigModule.default || turboConfigModule;
10
- const prettierConfig = require('eslint-config-prettier/flat');
1
+ import typescriptEslint from '@typescript-eslint/eslint-plugin';
2
+ import onlyWarn from 'eslint-plugin-only-warn';
3
+ import simpleImportSort from 'eslint-plugin-simple-import-sort';
4
+ import tsParser from '@typescript-eslint/parser';
5
+ import globals from 'globals';
6
+ import * as espree from 'espree';
7
+ import js from '@eslint/js';
8
+ import turboConfig from 'eslint-config-turbo/flat';
9
+ import prettierConfig from 'eslint-config-prettier/flat';
11
10
 
12
11
  // Rules that work for both JavaScript and TypeScript
13
12
  const commonRules = {
@@ -32,6 +31,18 @@ const commonRules = {
32
31
  'simple-import-sort/exports': 'warn',
33
32
  };
34
33
 
34
+ // Type-aware rules that require parserOptions.project to be true
35
+ const typeAwareRules = {
36
+ '@typescript-eslint/consistent-type-imports': [
37
+ 'warn',
38
+ {
39
+ prefer: 'type-imports',
40
+ },
41
+ ],
42
+
43
+ '@typescript-eslint/no-floating-promises': 'warn',
44
+ };
45
+
35
46
  // Rules that require TypeScript type information (only for .ts/.tsx files)
36
47
  const typescriptRules = {
37
48
  '@typescript-eslint/no-unused-vars': [
@@ -49,23 +60,14 @@ const typescriptRules = {
49
60
  '@typescript-eslint/no-explicit-any': 'off',
50
61
  '@typescript-eslint/no-non-null-assertion': 'off',
51
62
  '@typescript-eslint/no-empty-interface': 'off',
52
-
53
- '@typescript-eslint/consistent-type-imports': [
54
- 'warn',
55
- {
56
- prefer: 'type-imports',
57
- },
58
- ],
59
-
60
- '@typescript-eslint/no-floating-promises': 'warn',
61
63
  };
62
64
 
63
- module.exports = [
65
+ export default [
64
66
  // ESLint recommended rules
65
67
  js.configs.recommended,
66
68
 
67
- // Turbo config (flat config format) - spread if array, otherwise include directly
68
- ...(Array.isArray(turboConfig) ? turboConfig : [turboConfig]),
69
+ // Turbo config
70
+ ...turboConfig,
69
71
 
70
72
  // Prettier config
71
73
  prettierConfig,
@@ -97,6 +99,7 @@ module.exports = [
97
99
  '**/build/',
98
100
  '**/.next/',
99
101
  '**/.turbo/',
102
+ '**/.storybook/',
100
103
  '**/coverage/',
101
104
  '**/.eslintrc.*',
102
105
  '**/eslint.config.*',
@@ -130,6 +133,7 @@ module.exports = [
130
133
  },
131
134
  rules: {
132
135
  ...typescriptRules,
136
+ ...typeAwareRules,
133
137
  },
134
138
  },
135
139
 
package/package.json CHANGED
@@ -1,30 +1,18 @@
1
1
  {
2
2
  "name": "@layerzerolabs/eslint-configuration",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "private": false,
5
+ "type": "module",
5
6
  "exports": {
6
- "./base": "./base.js",
7
- "./next": "./next.js",
8
- "./node": "./node.js",
9
- "./server": "./server.js",
10
- "./react-base": "./react-base.js",
11
- "./react-internal": "./react-internal.js"
7
+ "./base": "./base.js"
12
8
  },
13
9
  "files": [
14
- "base.js",
15
- "next.js",
16
- "node.js",
17
- "server.js",
18
- "react-base.js",
19
- "react-internal.js"
10
+ "base.js"
20
11
  ],
21
12
  "devDependencies": {
22
- "@eslint/eslintrc": "^3.3.1",
23
13
  "@eslint/js": "^9.37.0",
24
- "@next/eslint-plugin-next": "15.1.3",
25
14
  "@typescript-eslint/eslint-plugin": "^8.31.1",
26
15
  "@typescript-eslint/parser": "^8.31.1",
27
- "@vercel/style-guide": "6.0.0",
28
16
  "eslint-config-prettier": "^10.1.2",
29
17
  "eslint-config-turbo": "^2.5.8",
30
18
  "eslint-plugin-only-warn": "1.1.0",
package/react-base.js DELETED
@@ -1,20 +0,0 @@
1
- const baseConfig = require('./base');
2
-
3
- /** @type {import("eslint").Linter.Config} */
4
- module.exports = Object.assign({}, baseConfig, {
5
- extends: [...baseConfig.extends, 'plugin:react/recommended', 'plugin:react-hooks/recommended'],
6
- plugins: [...baseConfig.plugins, 'react', 'react-hooks'],
7
- rules: {
8
- ...baseConfig.rules,
9
- 'react/jsx-key': 'off',
10
- 'react/prop-types': 'off',
11
- 'react/react-in-jsx-scope': 'off',
12
- 'react-hooks/rules-of-hooks': 'error',
13
- 'react-hooks/exhaustive-deps': 'warn',
14
- },
15
- settings: {
16
- react: {
17
- version: 'detect',
18
- },
19
- },
20
- });
package/react-internal.js DELETED
@@ -1,17 +0,0 @@
1
- const baseConfig = require('./react-base');
2
-
3
- /**
4
- * This is a custom ESLint configuration for use with
5
- * internal (bundled by their consumer) libraries
6
- * that utilize React.
7
- */
8
- /** @type {import("eslint").Linter.Config} */
9
- module.exports = Object.assign({}, baseConfig, {
10
- globals: {
11
- React: true,
12
- JSX: true,
13
- },
14
- env: {
15
- browser: true,
16
- },
17
- });
package/server.js DELETED
@@ -1,25 +0,0 @@
1
- const baseConfig = require('./base');
2
-
3
- /**
4
- * This is a custom ESLint configuration for use with Node.js server code.
5
- */
6
- /** @type {import("eslint").Linter.Config} */
7
- module.exports = Object.assign({}, baseConfig, {
8
- env: {
9
- node: true,
10
- vitest: true,
11
- },
12
- overrides: [
13
- ...baseConfig.overrides,
14
- {
15
- files: ['**/__tests__/**/*', '**/*.test.*', '**/*.spec.*'],
16
- extends: [],
17
- rules: {
18
- ...baseConfig.rules,
19
- 'no-console': 'off',
20
- '@typescript-eslint/no-explicit-any': 'off',
21
- '@typescript-eslint/no-non-null-assertion': 'off',
22
- },
23
- },
24
- ],
25
- });