Skip to content

Commit d0cde6a

Browse files
authored
refactor: update internal linting rules and use type-based imports (#184)
* chore: update ESLint config * refactor: apply eslint autofixes
1 parent 1698974 commit d0cde6a

11 files changed

+27
-16
lines changed

.eslintrc.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,17 @@ module.exports = {
2828
'@typescript-eslint/no-require-imports': 'error',
2929
'@typescript-eslint/ban-ts-comment': 'warn',
3030
'@typescript-eslint/ban-types': 'error',
31+
'@typescript-eslint/consistent-type-imports': [
32+
'error',
33+
{ disallowTypeAnnotations: false, fixStyle: 'inline-type-imports' },
34+
],
35+
'@typescript-eslint/no-import-type-side-effects': 'error',
3136
'@typescript-eslint/no-unused-vars': 'error',
3237
'eslint-comments/no-unused-disable': 'error',
38+
'eslint-plugin/require-meta-docs-description': [
39+
'error',
40+
{ pattern: '^(Enforce|Require|Disallow|Suggest|Prefer)' },
41+
],
3342
'eslint-plugin/test-case-property-ordering': 'error',
3443
'no-else-return': 'error',
3544
'no-negated-condition': 'error',
@@ -43,8 +52,9 @@ module.exports = {
4352
],
4453
'sort-imports': ['error', { ignoreDeclarationSort: true }],
4554
'require-unicode-regexp': 'error',
46-
// TS covers this
55+
// TS covers these 2
4756
'n/no-missing-import': 'off',
57+
'n/no-missing-require': 'off',
4858
'n/no-unsupported-features/es-syntax': 'off',
4959
'n/no-unsupported-features/es-builtins': 'error',
5060
'import/no-commonjs': 'error',
@@ -72,6 +82,7 @@ module.exports = {
7282
'prefer-rest-params': 'error',
7383
'prefer-const': ['error', { destructuring: 'all' }],
7484
'no-var': 'error',
85+
curly: 'error',
7586
},
7687
overrides: [
7788
{

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { readdirSync } from 'fs';
22
import { join, parse } from 'path';
3-
import { TSESLint, TSESTree } from '@typescript-eslint/utils';
3+
import type { TSESLint, TSESTree } from '@typescript-eslint/utils';
44
import {
55
name as packageName,
66
version as packageVersion,

src/rules/__tests__/prefer-to-be-array.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TSESLint } from '@typescript-eslint/utils';
2-
import rule, { MessageIds, Options } from '../prefer-to-be-array';
2+
import rule, { type MessageIds, type Options } from '../prefer-to-be-array';
33
import { espreeParser } from './test-utils';
44

55
const ruleTester = new TSESLint.RuleTester({

src/rules/__tests__/prefer-to-be-object.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TSESLint } from '@typescript-eslint/utils';
2-
import rule, { MessageIds, Options } from '../prefer-to-be-object';
2+
import rule, { type MessageIds, type Options } from '../prefer-to-be-object';
33

44
const ruleTester = new TSESLint.RuleTester();
55

src/rules/prefer-to-be-array.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
1+
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
22
import {
33
createRule,
44
followTypeAssertionChain,

src/rules/prefer-to-be-false.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
1+
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
22
import {
33
EqualityMatcher,
44
createRule,

src/rules/prefer-to-be-true.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
1+
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
22
import {
33
EqualityMatcher,
44
createRule,

src/rules/utils/__tests__/parseJestFnCall.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';
2-
import { TSESLint, TSESTree } from '@typescript-eslint/utils';
1+
import type { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package';
2+
import { TSESLint, type TSESTree } from '@typescript-eslint/utils';
33
import dedent from 'dedent';
44
import { espreeParser } from '../../__tests__/test-utils';
55
import {
6-
ParsedJestFnCall,
7-
ResolvedJestFnWithNode,
6+
type ParsedJestFnCall,
7+
type ResolvedJestFnWithNode,
88
createRule,
99
getAccessorValue,
1010
isSupportedAccessor,

src/rules/utils/accessors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
1+
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
22

33
/**
44
* A `Literal` with a `value` of type `string`.

src/rules/utils/followTypeAssertionChain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/utils';
1+
import { AST_NODE_TYPES, type TSESTree } from '@typescript-eslint/utils';
22

33
export type MaybeTypeCast<Expression extends TSESTree.Expression> =
44
| TSTypeCastExpression<Expression>

0 commit comments

Comments
 (0)