@straton/config 1.1.2

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/eslint/base.js ADDED
@@ -0,0 +1,43 @@
1
+ /** @type {import("eslint").Linter.Config} */
2
+ module.exports = {
3
+ extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
4
+ plugins: ['@typescript-eslint', 'import'],
5
+ parser: '@typescript-eslint/parser',
6
+ parserOptions: {
7
+ ecmaVersion: 'latest',
8
+ sourceType: 'module',
9
+ },
10
+ env: {
11
+ es2022: true,
12
+ node: true,
13
+ },
14
+ rules: {
15
+ '@typescript-eslint/no-unused-vars': [
16
+ 'error',
17
+ { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
18
+ ],
19
+ '@typescript-eslint/consistent-type-imports': [
20
+ 'warn',
21
+ { prefer: 'type-imports', fixStyle: 'inline-type-imports' },
22
+ ],
23
+ '@typescript-eslint/no-explicit-any': 'warn',
24
+ 'import/order': [
25
+ 'error',
26
+ {
27
+ groups: ['builtin', 'external', 'internal', ['parent', 'sibling'], 'index', 'type'],
28
+ 'newlines-between': 'always',
29
+ alphabetize: { order: 'asc', caseInsensitive: true },
30
+ },
31
+ ],
32
+ 'no-console': ['warn', { allow: ['warn', 'error'] }],
33
+ },
34
+ ignorePatterns: [
35
+ 'node_modules',
36
+ 'dist',
37
+ 'build',
38
+ '.turbo',
39
+ 'coverage',
40
+ '*.config.js',
41
+ '*.config.cjs',
42
+ ],
43
+ };
@@ -0,0 +1,55 @@
1
+ import eslintConfigPrettier from 'eslint-config-prettier';
2
+ import importPlugin from 'eslint-plugin-import';
3
+ import tseslint from 'typescript-eslint';
4
+
5
+ /** @type {import("eslint").Linter.Config[]} */
6
+ export const base = [
7
+ ...tseslint.configs.recommended,
8
+ eslintConfigPrettier,
9
+ importPlugin.flatConfigs.recommended,
10
+ importPlugin.flatConfigs.typescript,
11
+ {
12
+ settings: {
13
+ 'import/resolver': {
14
+ typescript: {
15
+ alwaysTryTypes: true,
16
+ },
17
+ },
18
+ },
19
+ rules: {
20
+ '@typescript-eslint/no-unused-vars': [
21
+ 'error',
22
+ { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
23
+ ],
24
+ '@typescript-eslint/consistent-type-imports': [
25
+ 'warn',
26
+ { prefer: 'type-imports', fixStyle: 'inline-type-imports' },
27
+ ],
28
+ '@typescript-eslint/no-explicit-any': 'warn',
29
+ 'import/order': [
30
+ 'error',
31
+ {
32
+ groups: ['builtin', 'external', 'internal', ['parent', 'sibling'], 'index', 'type'],
33
+ 'newlines-between': 'always',
34
+ alphabetize: { order: 'asc', caseInsensitive: true },
35
+ },
36
+ ],
37
+ 'no-console': ['warn', { allow: ['warn', 'error'] }],
38
+ },
39
+ },
40
+ {
41
+ ignores: [
42
+ 'node_modules/**',
43
+ 'dist/**',
44
+ 'build/**',
45
+ '.turbo/**',
46
+ 'coverage/**',
47
+ '.next/**',
48
+ '*.config.js',
49
+ '*.config.cjs',
50
+ '*.config.mjs',
51
+ ],
52
+ },
53
+ ];
54
+
55
+ export default base;
@@ -0,0 +1,27 @@
1
+ /** @type {import("eslint").Linter.Config} */
2
+ module.exports = {
3
+ extends: [
4
+ './base.js',
5
+ 'next/core-web-vitals',
6
+ 'plugin:react/recommended',
7
+ 'plugin:react-hooks/recommended',
8
+ ],
9
+ plugins: ['react', 'react-hooks'],
10
+ settings: {
11
+ react: {
12
+ version: 'detect',
13
+ },
14
+ },
15
+ env: {
16
+ browser: true,
17
+ node: true,
18
+ },
19
+ rules: {
20
+ 'react/react-in-jsx-scope': 'off',
21
+ 'react/prop-types': 'off',
22
+ 'react/no-unescaped-entities': 'off',
23
+ 'react-hooks/rules-of-hooks': 'error',
24
+ 'react-hooks/exhaustive-deps': 'warn',
25
+ '@next/next/no-html-link-for-pages': 'off',
26
+ },
27
+ };
@@ -0,0 +1,34 @@
1
+ import nextPlugin from '@next/eslint-plugin-next';
2
+ import reactPlugin from 'eslint-plugin-react';
3
+ import reactHooksPlugin from 'eslint-plugin-react-hooks';
4
+
5
+ import { base } from './base.mjs';
6
+
7
+ /** @type {import("eslint").Linter.Config[]} */
8
+ export const nextjs = [
9
+ ...base,
10
+ reactPlugin.configs.flat.recommended,
11
+ reactPlugin.configs.flat['jsx-runtime'],
12
+ {
13
+ plugins: {
14
+ '@next/next': nextPlugin,
15
+ 'react-hooks': reactHooksPlugin,
16
+ },
17
+ rules: {
18
+ ...nextPlugin.flatConfig.recommended.rules,
19
+ ...nextPlugin.flatConfig.coreWebVitals.rules,
20
+ 'react-hooks/rules-of-hooks': 'error',
21
+ 'react-hooks/exhaustive-deps': 'warn',
22
+ 'react/prop-types': 'off',
23
+ 'react/no-unescaped-entities': 'off',
24
+ '@next/next/no-html-link-for-pages': 'off',
25
+ },
26
+ settings: {
27
+ react: {
28
+ version: 'detect',
29
+ },
30
+ },
31
+ },
32
+ ];
33
+
34
+ export default nextjs;
package/eslint/node.js ADDED
@@ -0,0 +1,13 @@
1
+ /** @type {import("eslint").Linter.Config} */
2
+ module.exports = {
3
+ extends: ['./base.js'],
4
+ env: {
5
+ node: true,
6
+ jest: true,
7
+ },
8
+ rules: {
9
+ '@typescript-eslint/interface-name-prefix': 'off',
10
+ '@typescript-eslint/explicit-function-return-type': 'off',
11
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
12
+ },
13
+ };
@@ -0,0 +1,14 @@
1
+ import { base } from './base.mjs';
2
+
3
+ /** @type {import("eslint").Linter.Config[]} */
4
+ export const node = [
5
+ ...base,
6
+ {
7
+ rules: {
8
+ '@typescript-eslint/explicit-function-return-type': 'off',
9
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
10
+ },
11
+ },
12
+ ];
13
+
14
+ export default node;
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@straton/config",
3
+ "version": "1.1.2",
4
+ "description": "Shared ESLint, TypeScript, and Prettier configs for the Straton platform",
5
+ "private": false,
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Straton-Finance/Straton-Packages.git",
12
+ "directory": "packages/config"
13
+ },
14
+ "files": [
15
+ "eslint",
16
+ "typescript",
17
+ "prettier.config.js"
18
+ ],
19
+ "devDependencies": {
20
+ "@typescript-eslint/eslint-plugin": "^8.18.0",
21
+ "@typescript-eslint/parser": "^8.18.0",
22
+ "eslint": "^9.17.0",
23
+ "eslint-config-next": "^15.1.0",
24
+ "eslint-config-prettier": "^9.1.0",
25
+ "eslint-import-resolver-typescript": "^4.4.4",
26
+ "eslint-plugin-import": "^2.31.0",
27
+ "eslint-plugin-react": "^7.37.2",
28
+ "eslint-plugin-react-hooks": "^5.1.0",
29
+ "prettier": "^3.4.2",
30
+ "prettier-plugin-tailwindcss": "^0.7.2",
31
+ "typescript": "^5.7.2",
32
+ "typescript-eslint": "^8.57.0"
33
+ }
34
+ }
@@ -0,0 +1,13 @@
1
+ /** @type {import("prettier").Config} */
2
+ module.exports = {
3
+ semi: true,
4
+ singleQuote: true,
5
+ tabWidth: 2,
6
+ trailingComma: 'es5',
7
+ printWidth: 100,
8
+ bracketSpacing: true,
9
+ arrowParens: 'always',
10
+ endOfLine: 'lf',
11
+ plugins: ['prettier-plugin-tailwindcss'],
12
+ tailwindFunctions: ['cn', 'clsx', 'cva'],
13
+ };
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Base",
4
+ "compilerOptions": {
5
+ "target": "ES2022",
6
+ "lib": ["ES2022"],
7
+ "module": "ESNext",
8
+ "moduleResolution": "bundler",
9
+ "resolveJsonModule": true,
10
+ "allowJs": true,
11
+ "strict": true,
12
+ "noUncheckedIndexedAccess": true,
13
+ "noEmit": true,
14
+ "esModuleInterop": true,
15
+ "forceConsistentCasingInFileNames": true,
16
+ "skipLibCheck": true,
17
+ "declaration": true,
18
+ "declarationMap": true,
19
+ "sourceMap": true,
20
+ "isolatedModules": true,
21
+ "verbatimModuleSyntax": true,
22
+ "noImplicitOverride": true,
23
+ "noImplicitReturns": true,
24
+ "noFallthroughCasesInSwitch": true,
25
+ "noUnusedLocals": true,
26
+ "noUnusedParameters": true
27
+ },
28
+ "exclude": ["node_modules", "dist", "build", ".turbo"]
29
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Next.js",
4
+ "extends": "./base.json",
5
+ "compilerOptions": {
6
+ "lib": ["DOM", "DOM.Iterable", "ES2022"],
7
+ "module": "ESNext",
8
+ "moduleResolution": "bundler",
9
+ "jsx": "preserve",
10
+ "plugins": [
11
+ {
12
+ "name": "next"
13
+ }
14
+ ],
15
+ "allowJs": true,
16
+ "incremental": true
17
+ }
18
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Node.js / NestJS",
4
+ "extends": "./base.json",
5
+ "compilerOptions": {
6
+ "lib": ["ES2022"],
7
+ "module": "NodeNext",
8
+ "moduleResolution": "NodeNext",
9
+ "target": "ES2022",
10
+ "outDir": "./dist",
11
+ "rootDir": "./src",
12
+ "declaration": true,
13
+ "declarationMap": true,
14
+ "noEmit": false,
15
+ "emitDecoratorMetadata": true,
16
+ "experimentalDecorators": true
17
+ }
18
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "React Library",
4
+ "extends": "./base.json",
5
+ "compilerOptions": {
6
+ "lib": ["DOM", "DOM.Iterable", "ES2022"],
7
+ "jsx": "react-jsx",
8
+ "outDir": "./dist",
9
+ "rootDir": "./src",
10
+ "noEmit": false
11
+ }
12
+ }