chore: upgrade to eslint 9 · vitejs/vite-plugin-vue@236a40f (original) (raw)

``

1

`+

// @ts-check

`

``

2

`+

import { builtinModules } from 'node:module'

`

``

3

`+

import eslint from '@eslint/js'

`

``

4

`+

import tseslint from 'typescript-eslint'

`

``

5

`+

import nodePlugin from 'eslint-plugin-n'

`

``

6

`+

import * as regexpPlugin from 'eslint-plugin-regexp'

`

``

7

`+

import importPlugin from 'eslint-plugin-import-x'

`

``

8

+

``

9

`+

export default tseslint.config(

`

``

10

`+

eslint.configs.recommended,

`

``

11

`+

...tseslint.configs.recommended,

`

``

12

`+

nodePlugin.configs['flat/recommended'],

`

``

13

`+

regexpPlugin.configs['flat/recommended'],

`

``

14

`+

{ ignores: ['/dist', '/playground-temp', '**/temp'] },

`

``

15

`+

{

`

``

16

`+

plugins: {

`

``

17

`+

import: importPlugin,

`

``

18

`+

},

`

``

19

`+

rules: {

`

``

20

`+

eqeqeq: ['warn', 'always', { null: 'never' }],

`

``

21

`+

'no-empty': ['warn', { allowEmptyCatch: true }],

`

``

22

`+

'no-useless-escape': 'off',

`

``

23

`+

'prefer-const': ['warn', { destructuring: 'all' }],

`

``

24

+

``

25

`+

'n/no-process-exit': 'off',

`

``

26

`+

'n/no-missing-import': [

`

``

27

`+

'error',

`

``

28

`+

{

`

``

29

`+

allowModules: ['types', 'estree', 'less', 'sass', 'stylus'],

`

``

30

`+

tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'],

`

``

31

`+

},

`

``

32

`+

],

`

``

33

`+

'n/no-missing-require': [

`

``

34

`+

'error',

`

``

35

`+

{

`

``

36

`+

// for try-catching yarn pnp

`

``

37

`+

allowModules: ['pnpapi', 'vite'],

`

``

38

`+

tryExtensions: ['.ts', '.js', '.jsx', '.tsx', '.d.ts'],

`

``

39

`+

},

`

``

40

`+

],

`

``

41

`+

'n/no-extraneous-import': [

`

``

42

`+

'error',

`

``

43

`+

{ allowModules: ['vite', 'less', 'sass', 'vitest', 'unbuild'] },

`

``

44

`+

],

`

``

45

`+

'n/no-extraneous-require': ['error', { allowModules: ['vite'] }],

`

``

46

`+

'n/no-deprecated-api': 'off',

`

``

47

`+

'n/no-unpublished-import': 'off',

`

``

48

`+

'n/no-unpublished-require': 'off',

`

``

49

`+

'n/no-unsupported-features/es-syntax': 'off',

`

``

50

+

``

51

`+

'@typescript-eslint/ban-ts-comment': 'off', // TODO: we should turn this on in a new PR

`

``

52

`+

'@typescript-eslint/explicit-module-boundary-types': [

`

``

53

`+

'error',

`

``

54

`+

{ allowArgumentsExplicitlyTypedAsAny: true },

`

``

55

`+

],

`

``

56

`+

'@typescript-eslint/no-empty-function': [

`

``

57

`+

'error',

`

``

58

`+

{ allow: ['arrowFunctions'] },

`

``

59

`+

],

`

``

60

`+

'@typescript-eslint/no-empty-object-type': 'off',

`

``

61

`+

'@typescript-eslint/no-explicit-any': 'off', // maybe we should turn this on in a new PR

`

``

62

`+

'@typescript-eslint/no-inferrable-types': 'off',

`

``

63

`+

'@typescript-eslint/no-unused-vars': 'off', // maybe we should turn this on in a new PR

`

``

64

`+

'@typescript-eslint/no-require-imports': 'off',

`

``

65

`+

'@typescript-eslint/consistent-type-imports': [

`

``

66

`+

'error',

`

``

67

`+

{ prefer: 'type-imports' },

`

``

68

`+

],

`

``

69

+

``

70

`+

'import/no-nodejs-modules': [

`

``

71

`+

'error',

`

``

72

`` +

{ allow: builtinModules.map((mod) => node:${mod}) },

``

``

73

`+

],

`

``

74

`+

'import/no-duplicates': 'error',

`

``

75

`+

'import/order': 'error',

`

``

76

`+

'sort-imports': [

`

``

77

`+

'error',

`

``

78

`+

{

`

``

79

`+

ignoreCase: false,

`

``

80

`+

ignoreDeclarationSort: true,

`

``

81

`+

ignoreMemberSort: false,

`

``

82

`+

memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],

`

``

83

`+

allowSeparatedGroups: false,

`

``

84

`+

},

`

``

85

`+

],

`

``

86

+

``

87

`+

'regexp/no-contradiction-with-assertion': 'error',

`

``

88

`+

},

`

``

89

`+

},

`

``

90

`+

{

`

``

91

`+

files: ['packages/**'],

`

``

92

`+

ignores: ['/tests/'],

`

``

93

`+

rules: {

`

``

94

`+

'no-restricted-globals': ['error', 'require', '__dirname', '__filename'],

`

``

95

`+

},

`

``

96

`+

},

`

``

97

`+

{

`

``

98

`+

files: ['*.spec.ts'],

`

``

99

`+

rules: {

`

``

100

`+

'n/no-extraneous-import': 'off',

`

``

101

`+

},

`

``

102

`+

},

`

``

103

`+

{

`

``

104

`+

files: ['**/build.config.ts'],

`

``

105

`+

rules: {

`

``

106

`+

'no-undef': 'off',

`

``

107

`+

'n/no-missing-import': 'off',

`

``

108

`+

'@typescript-eslint/explicit-module-boundary-types': 'off',

`

``

109

`+

},

`

``

110

`+

},

`

``

111

`+

{

`

``

112

`+

files: ['playground/**'],

`

``

113

`+

rules: {

`

``

114

`+

'n/no-extraneous-import': 'off',

`

``

115

`+

'n/no-extraneous-require': 'off',

`

``

116

`+

'n/no-missing-import': 'off',

`

``

117

`+

'n/no-missing-require': 'off',

`

``

118

`+

// engine field doesn't exist in playgrounds

`

``

119

`+

'n/no-unsupported-features/es-builtins': [

`

``

120

`+

'error',

`

``

121

`+

{

`

``

122

`+

version: '^18.0.0 || >=20.0.0',

`

``

123

`+

},

`

``

124

`+

],

`

``

125

`+

'n/no-unsupported-features/node-builtins': [

`

``

126

`+

'error',

`

``

127

`+

{

`

``

128

`+

version: '^18.0.0 || >=20.0.0',

`

``

129

`+

},

`

``

130

`+

],

`

``

131

`+

'@typescript-eslint/explicit-module-boundary-types': 'off',

`

``

132

`+

},

`

``

133

`+

},

`

``

134

`+

{

`

``

135

`+

files: ['playground/**'],

`

``

136

`+

ignores: ['/tests/'],

`

``

137

`+

rules: {

`

``

138

`+

'no-undef': 'off',

`

``

139

`+

'no-empty': 'off',

`

``

140

`+

'no-constant-condition': 'off',

`

``

141

`+

'@typescript-eslint/no-empty-function': 'off',

`

``

142

`+

},

`

``

143

`+

},

`

``

144

`+

{

`

``

145

`+

files: ['.js', '.mjs', '*.cjs'],

`

``

146

`+

rules: {

`

``

147

`+

'@typescript-eslint/explicit-module-boundary-types': 'off',

`

``

148

`+

},

`

``

149

`+

},

`

``

150

`+

{

`

``

151

`+

files: ['*.d.ts'],

`

``

152

`+

rules: {

`

``

153

`+

'@typescript-eslint/triple-slash-reference': 'off',

`

``

154

`+

},

`

``

155

`+

},

`

``

156

`+

)

`