@daniel-rose/eslint-config 1.0.0

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/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # @daniel-rose/eslint-config
2
+
3
+ > Shared ESLint configuration for TypeScript and React projects
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@daniel-rose/eslint-config.svg)](https://www.npmjs.com/package/@daniel-rose/eslint-config)
6
+ [![License](https://img.shields.io/npm/l/@daniel-rose/eslint-config.svg)](https://github.com/daniel-rose/envex/blob/main/LICENSE)
7
+
8
+ Opinionated ESLint 9 flat config with TypeScript, Prettier integration, and an optional React preset.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ # npm
14
+ npm install @daniel-rose/eslint-config
15
+
16
+ # yarn
17
+ yarn add @daniel-rose/eslint-config
18
+
19
+ # pnpm
20
+ pnpm add @daniel-rose/eslint-config
21
+ ```
22
+
23
+ Peer dependencies: `eslint ^9`
24
+ Optional peers (for React): `eslint-plugin-react-hooks`, `eslint-plugin-react-refresh`
25
+
26
+ ## Usage
27
+
28
+ ### Base (TypeScript)
29
+
30
+ ```js
31
+ // eslint.config.js
32
+ import { baseConfig } from '@daniel-rose/eslint-config'
33
+
34
+ export default [...baseConfig]
35
+ ```
36
+
37
+ ### React
38
+
39
+ ```js
40
+ // eslint.config.js
41
+ import { reactConfig } from '@daniel-rose/eslint-config/react'
42
+
43
+ export default [...reactConfig]
44
+ ```
45
+
46
+ ### Included Rules
47
+
48
+ - `no-console` — only `warn` and `error` are allowed
49
+ - `@typescript-eslint/consistent-type-imports` — enforces `type` imports
50
+ - Prettier integration via `eslint-plugin-prettier`
51
+
52
+ ## License
53
+
54
+ MIT © Daniel Rose
55
+
56
+ Links
57
+
58
+ - GitHub: https://github.com/daniel-rose/envex
59
+ - npm: https://www.npmjs.com/package/@daniel-rose/eslint-config
package/dist/base.js ADDED
@@ -0,0 +1,36 @@
1
+ import js from '@eslint/js'
2
+ import eslintConfigPrettier from 'eslint-config-prettier/flat'
3
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
4
+ import tseslint from 'typescript-eslint'
5
+
6
+ export const sharedRules = {
7
+ 'no-console': ['error', { allow: ['warn', 'error'] }],
8
+ '@typescript-eslint/consistent-type-imports': [
9
+ 'error',
10
+ {
11
+ prefer: 'type-imports',
12
+ fixStyle: 'separate-type-imports',
13
+ },
14
+ ],
15
+ }
16
+
17
+ export const baseConfig = tseslint.config(
18
+ { ignores: ['dist'] },
19
+ {
20
+ files: ['**/*.ts'],
21
+ languageOptions: {
22
+ parser: tseslint.parser,
23
+ parserOptions: {
24
+ projectService: true,
25
+ },
26
+ sourceType: 'module',
27
+ },
28
+ extends: [
29
+ js.configs.recommended,
30
+ ...tseslint.configs.recommendedTypeChecked,
31
+ ],
32
+ rules: sharedRules,
33
+ },
34
+ eslintConfigPrettier,
35
+ eslintPluginPrettierRecommended
36
+ )
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { baseConfig, sharedRules } from './base.js'
package/dist/react.js ADDED
@@ -0,0 +1,54 @@
1
+ import js from '@eslint/js'
2
+ import eslintConfigPrettier from 'eslint-config-prettier/flat'
3
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
4
+ import reactHooks from 'eslint-plugin-react-hooks'
5
+ import reactRefresh from 'eslint-plugin-react-refresh'
6
+ import tseslint from 'typescript-eslint'
7
+ import { sharedRules } from './base.js'
8
+
9
+ export const reactConfig = tseslint.config(
10
+ { ignores: ['dist'] },
11
+ {
12
+ files: ['**/*.ts'],
13
+ languageOptions: {
14
+ parser: tseslint.parser,
15
+ parserOptions: {
16
+ projectService: true,
17
+ },
18
+ sourceType: 'module',
19
+ },
20
+ extends: [
21
+ js.configs.recommended,
22
+ ...tseslint.configs.recommendedTypeChecked,
23
+ ],
24
+ rules: sharedRules,
25
+ },
26
+ {
27
+ files: ['**/*.tsx'],
28
+ languageOptions: {
29
+ parser: tseslint.parser,
30
+ parserOptions: {
31
+ projectService: true,
32
+ },
33
+ sourceType: 'module',
34
+ },
35
+ extends: [
36
+ js.configs.recommended,
37
+ ...tseslint.configs.recommendedTypeChecked,
38
+ ],
39
+ plugins: {
40
+ 'react-hooks': reactHooks,
41
+ 'react-refresh': reactRefresh,
42
+ },
43
+ rules: {
44
+ ...sharedRules,
45
+ ...reactHooks.configs.recommended.rules,
46
+ 'react-refresh/only-export-components': [
47
+ 'warn',
48
+ { allowConstantExport: true },
49
+ ],
50
+ },
51
+ },
52
+ eslintConfigPrettier,
53
+ eslintPluginPrettierRecommended
54
+ )
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@daniel-rose/eslint-config",
3
+ "version": "1.0.0",
4
+ "license": "MIT",
5
+ "author": "Daniel Rose",
6
+ "keywords": [
7
+ "eslint",
8
+ "config"
9
+ ],
10
+ "type": "module",
11
+ "scripts": {
12
+ "build": "mkdir -p ./dist && cp index.js base.js react.js ./dist/",
13
+ "format": "prettier . --write",
14
+ "format:check": "prettier . --check",
15
+ "lint": "eslint ."
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "exports": {
24
+ ".": {
25
+ "import": "./dist/index.js"
26
+ },
27
+ "./react": {
28
+ "import": "./dist/react.js"
29
+ }
30
+ },
31
+ "dependencies": {
32
+ "@eslint/js": "^9.39.2",
33
+ "eslint-config-prettier": "^10.1.8",
34
+ "eslint-plugin-prettier": "^5.5.5",
35
+ "typescript-eslint": "^8.55.0"
36
+ },
37
+ "peerDependencies": {
38
+ "eslint": "^9",
39
+ "eslint-plugin-react-hooks": "^7.0.1",
40
+ "eslint-plugin-react-refresh": "^0.5.0"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "eslint-plugin-react-hooks": {
44
+ "optional": true
45
+ },
46
+ "eslint-plugin-react-refresh": {
47
+ "optional": true
48
+ }
49
+ },
50
+ "devDependencies": {
51
+ "@daniel-rose/prettier-config": "^1.0.0",
52
+ "@daniel-rose/semantic-release-config": "^1.0.0",
53
+ "eslint": "^9.39.2",
54
+ "eslint-plugin-react-hooks": "^7.0.1",
55
+ "eslint-plugin-react-refresh": "^0.5.0",
56
+ "prettier": "^3.8.1",
57
+ "semantic-release": "^25.0.3"
58
+ },
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "git+https://github.com/daniel-rose/monorepo.git",
62
+ "directory": "configs/eslint"
63
+ },
64
+ "bugs": {
65
+ "url": "https://github.com/daniel-rose/monorepo/issues"
66
+ },
67
+ "homepage": "https://github.com/daniel-rose/monorepo/blob/main/configs/eslint/README.md"
68
+ }