@tuomashatakka/eslint-config 2.2.2 → 2.2.3

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 CHANGED
@@ -1,9 +1,57 @@
1
- # Rules for my linter
1
+ # @tuomashatakka/eslint-config
2
2
 
3
- Heavily opionated yet heavily clean and effective linter configuration for ESLint.
3
+ > Opinionated yet functional AF base config for ESLint using the new flat config format
4
4
 
5
- For Next, React and TS
5
+ For Next.js, React and TypeScript projects.
6
6
 
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install --save-dev @tuomashatakka/eslint-config
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ### Using the full config
16
+
17
+ Create an `eslint.config.js` file in your project root:
18
+
19
+ ```javascript
20
+ import config from '@tuomashatakka/eslint-config'
21
+
22
+ export default config
23
+ ```
24
+
25
+ ### Using just the rules
26
+
27
+ If you want to use only the rules in your own config:
28
+
29
+ ```javascript
30
+ import { rules } from '@tuomashatakka/eslint-config'
31
+
32
+ export default [
33
+ // Your custom config here
34
+ {
35
+ // ...
36
+ rules
37
+ }
38
+ ]
39
+ ```
40
+
41
+ ## Features
42
+
43
+ - TypeScript support
44
+ - React/JSX support
45
+ - Modern JavaScript features
46
+ - Stylistic rules for consistent code formatting
47
+ - Import/export validation
48
+
49
+ ## Structure
50
+
51
+ The package uses ESLint's flat config format and has a simple structure:
52
+
53
+ - `index.mjs` - Exports the full config and rules
54
+ - `rules.mjs` - Contains all the ESLint rules
7
55
 
8
56
  ### Todo
9
57
 
@@ -11,3 +59,7 @@ For Next, React and TS
11
59
  - I really love Python's enforced linting style for having two rows between major blocks
12
60
  and 1 row between minor. I should finish my block padding plugin some day for the ESLinter.
13
61
  My linting rules would really appreciate that.
62
+
63
+ ## License
64
+
65
+ ISC
@@ -0,0 +1,4 @@
1
+ import { config } from './index.js'
2
+
3
+
4
+ export default config
@@ -1,4 +1,3 @@
1
- /* eslint-disable multiline-comment-style */
2
1
  import stylistic from '@stylistic/eslint-plugin'
3
2
  import tsplugin from '@typescript-eslint/eslint-plugin'
4
3
  import importPlugin from 'eslint-plugin-import'
@@ -6,7 +5,7 @@ import react from 'eslint-plugin-react'
6
5
  import globals from 'globals'
7
6
  import tseslint from 'typescript-eslint'
8
7
 
9
- import rules from './rules.mjs'
8
+ import { rules } from './rules.js'
10
9
 
11
10
 
12
11
  const plugins = {
@@ -18,11 +17,13 @@ const plugins = {
18
17
 
19
18
  /**
20
19
  * @type {tseslint.configs.base}
21
- **/
20
+ */
22
21
  const config = tseslint.config(
23
22
  ...tseslint.configs.recommended,
24
23
  {
25
24
  languageOptions: {
25
+ ecmaVersion: 'latest',
26
+ sourceType: 'module',
26
27
  parserOptions: {
27
28
  ecmaFeatures: {
28
29
  jsx: true,
@@ -46,13 +47,31 @@ const config = tseslint.config(
46
47
  },
47
48
  plugins,
48
49
  rules,
50
+ },
51
+ {
52
+ files: [ '**/*.{js,jsx,mjs,cjs,ts,tsx}' ],
53
+ languageOptions: {
54
+ ecmaVersion: 'latest',
55
+ sourceType: 'module',
56
+ parserOptions: {
57
+ ecmaFeatures: {
58
+ jsx: true,
59
+ },
60
+ },
61
+ globals: {
62
+ ...globals.browser,
63
+ },
64
+ }
49
65
  }
50
66
  )
51
67
 
52
68
  /**
53
69
  * @summary ESLint configuration
54
70
  * @description Opinionated yet functional AF base config for ESLint
55
- * @author {@author}
56
- * @version {@version}
57
- **/
71
+ */
58
72
  export default config
73
+
74
+ export {
75
+ config,
76
+ rules
77
+ }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@tuomashatakka/eslint-config",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Default eslint configuration",
5
5
  "type": "module",
6
- "main": "index.mjs",
6
+ "main": "index.js",
7
7
  "scripts": {
8
- "lint": "eslint . --config eslint.config.mjs"
8
+ "lint": "eslint . --config index.mjs"
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
@@ -2,7 +2,6 @@
2
2
  * @exports {import("eslint/rules").ESLintRules} rules
3
3
  * @type {import("@eslint/core").RulesConfig}
4
4
  */
5
-
6
5
  export const rules = {
7
6
 
8
7
  // '@next/next/no-styled-jsx-in-document': [ 'error' ],
@@ -193,4 +192,5 @@ export const rules = {
193
192
  '@stylistic/space-before-function-paren': [ 1, 'always' ]
194
193
  }
195
194
 
195
+ // Make sure we export both named and default exports
196
196
  export default rules
package/index.mjs DELETED
@@ -1,34 +0,0 @@
1
- import globals from 'globals'
2
- import tseslint from 'typescript-eslint'
3
-
4
- import config from './eslint.config.mjs'
5
-
6
-
7
- const configType = tseslint.configs.base
8
-
9
- /**
10
- * @name config
11
- * @type {typeof configType}
12
- */
13
- export default [
14
- ...config,
15
- {
16
- files: [ '**/*.{js,jsx,mjs,cjs,ts,tsx}' ],
17
- languageOptions: {
18
- ecmaVersion: 'latest',
19
- sourceType: 'module',
20
- parserOptions: {
21
- ecmaFeatures: {
22
- jsx: true,
23
- },
24
- },
25
- globals: {
26
- ...globals.browser,
27
- },
28
- }
29
- }]
30
-
31
- export {
32
- config,
33
- configType
34
- }