@tuomashatakka/eslint-config 2.2.0 → 2.2.1

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.config.mjs CHANGED
@@ -3,6 +3,7 @@ import stylistic from '@stylistic/eslint-plugin'
3
3
  import tsplugin from '@typescript-eslint/eslint-plugin'
4
4
  import importPlugin from 'eslint-plugin-import'
5
5
  import react from 'eslint-plugin-react'
6
+ import globals from 'globals'
6
7
  import tseslint from 'typescript-eslint'
7
8
 
8
9
  import rules from './rules.mjs'
@@ -27,9 +28,14 @@ const config = tseslint.config(
27
28
  jsx: true,
28
29
  },
29
30
  },
31
+ globals: {
32
+ ...globals.browser,
33
+ ...globals.node,
34
+ }
30
35
  },
31
36
  settings: {
32
- 'import/resolver': {
37
+ 'import/internal-regex': '^@/(.+)',
38
+ 'import/resolver': {
33
39
  node: {
34
40
  extensions: [ '.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs' ],
35
41
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuomashatakka/eslint-config",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Default eslint configuration",
5
5
  "type": "module",
6
6
  "main": "index.mjs",
package/rules.mjs CHANGED
@@ -26,17 +26,15 @@ export const rules = {
26
26
  'import/prefer-default-export': [ 'error' ],
27
27
  'import/no-mutable-exports': [ 'error' ],
28
28
  'import/order': [ 'warn', {
29
- 'groups': [ 'builtin', 'type', 'external', [ 'parent', 'sibling', 'index' ], 'internal', 'object' ],
29
+ 'groups': [ 'builtin', 'type', 'external', [ 'parent', 'sibling', 'index' ], [ 'internal', 'object' ]],
30
30
  'alphabetize': { order: 'asc', caseInsensitive: true },
31
31
  'distinctGroup': true,
32
32
  'warnOnUnassignedImports': true,
33
33
  'newlines-between': 'always',
34
34
  'pathGroups': [
35
- { group: 'internal', pattern: '**/*.css', position: 'after' },
36
- { group: 'object', pattern: '**/*.scss' },
37
- { group: 'parent', pattern: '@/**' },
38
- { group: 'parent', pattern: '../**' },
39
- { group: 'sibling', pattern: './**' }]}],
35
+ { group: 'internal', pattern: '**/*.s?css' }
36
+ ]}
37
+ ],
40
38
 
41
39
  // Typescript
42
40
  '@typescript-eslint/ban-ts-comment': [ 'off', 'allow-single-line' ],
@@ -122,7 +120,6 @@ export const rules = {
122
120
  '@stylistic/jsx-newline': [ 'warn', { prevent: true, allowMultilines: true }],
123
121
  '@stylistic/jsx-props-no-multi-spaces': [ 'warn' ],
124
122
  '@stylistic/jsx-equals-spacing': [ 'warn', 'never' ],
125
- '@stylistic/jsx-indent-props': [ 'warn', 2 ],
126
123
  '@stylistic/jsx-max-props-per-line': [ 'warn', { maximum: 1, when: 'multiline' }],
127
124
  '@stylistic/jsx-self-closing-comp': [ 'warn', { component: true, html: true }],
128
125
  '@stylistic/jsx-one-expression-per-line': [ 'warn', { allow: 'single-child' }],
@@ -141,8 +138,6 @@ export const rules = {
141
138
  'react/jsx-closing-tag-location': [ 'warn', 'line-aligned' ],
142
139
  'react/jsx-equals-spacing': [ 'warn', 'never' ],
143
140
  'react/jsx-first-prop-new-line': [ 'warn', 'multiline' ],
144
- 'react/jsx-indent': [ 'warn', 2, { checkAttributes: true, indentLogicalExpressions: true }],
145
- 'react/jsx-indent-props': [ 'warn', 2 ],
146
141
  'react/jsx-max-props-per-line': [ 'warn', { maximum: 1, when: 'multiline' }],
147
142
  'react/jsx-no-constructed-context-values': [ 'warn' ],
148
143
  'react/jsx-no-script-url': [ 'warn' ],
@@ -154,6 +149,10 @@ export const rules = {
154
149
  'react/jsx-curly-spacing': [ 'warn', { when: 'never', children: true }],
155
150
  'react/display-name': [ 'warn', { checkContextObjects: true }],
156
151
 
152
+ 'import/prefer-default-export': 'off',
153
+ '@stylistic/jsx-indent-props': [ 'warn', { indentMode: 2, ignoreTernaryOperator: true }],
154
+ '@stylistic/indent': [ 'warn', 2, { offsetTernaryExpressions: false, flatTernaryExpressions: true }],
155
+
157
156
  // Block padding
158
157
  '@stylistic/no-multi-spaces': [ 'warn', { exceptions: { Property: true, TSTypeAnnotation: true, VariableDeclarator: true, ObjectExpression: false }}],
159
158
  '@stylistic/spaced-comment': [ 'warn', 'always', { markers: [ '/' ]}],