standard-tsx 0.0.1 → 0.0.2

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/HISTORY.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.0.2
2
+ * [Fix gitignore not being ignored in ESLint v9](https://github.com/extremeheat/standard-tsx/commit/5cf299712901d01b873102ef34929f7cef171189) (thanks @extremeheat)
3
+
1
4
  ## 0.0.1
2
5
 
3
- * Initial release
6
+ * Initial release
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "standard-tsx",
3
- "version": "0.0.1",
4
- "description": "standardjs lint with typescript file support (with no new typescript rules)",
3
+ "version": "0.0.2",
4
+ "description": "standardjs lint with TypeScript and JSX file support (with no new typescript rules)",
5
5
  "main": "src/index.js",
6
6
  "bin": {
7
7
  "standard-tsx": "./src/cli.js"
@@ -16,7 +16,15 @@
16
16
  "type": "git",
17
17
  "url": "git+https://github.com/extremeheat/standard-tsx.git"
18
18
  },
19
- "keywords": [],
19
+ "keywords": [
20
+ "standard",
21
+ "lint",
22
+ "eslint",
23
+ "react",
24
+ "ts",
25
+ "tsx",
26
+ "typescript"
27
+ ],
20
28
  "author": "extremeheat",
21
29
  "license": "MIT",
22
30
  "bugs": {
@@ -28,6 +36,7 @@
28
36
  "standard-tsx": "file:."
29
37
  },
30
38
  "dependencies": {
39
+ "@eslint/compat": "^1.2.7",
31
40
  "@eslint/js": "^9.21.0",
32
41
  "@typescript-eslint/eslint-plugin": "^8.26.0",
33
42
  "@typescript-eslint/parser": "^8.26.0",
@@ -36,6 +45,7 @@
36
45
  "eslint-plugin-eslint-env-restore": "^1.0.0",
37
46
  "eslint-plugin-react": "^7.37.4",
38
47
  "eslint-plugin-react-hooks": "^5.2.0",
48
+ "glob": "^11.0.1",
39
49
  "globals": "^16.0.0",
40
50
  "typescript-eslint": "^8.26.0"
41
51
  },
@@ -7,10 +7,30 @@ const importPlugin = require('eslint-plugin-import')
7
7
  const nPlugin = require('eslint-plugin-n')
8
8
  const promisePlugin = require('eslint-plugin-promise')
9
9
  const eslintEnvRestorePlugin = require('eslint-plugin-eslint-env-restore')
10
- const reactPlugin = require('eslint-plugin-react') // Added React plugin
11
- const reactHooksPlugin = require('eslint-plugin-react-hooks') // Added React Hooks plugin
10
+ const reactPlugin = require('eslint-plugin-react')
11
+ const reactHooksPlugin = require('eslint-plugin-react-hooks')
12
+
13
+ const { includeIgnoreFile } = require('@eslint/compat')
14
+ const path = require('node:path')
15
+ const glob = require('glob')
16
+
17
+ const gitignoreFiles = glob.sync('**/.gitignore', { cwd: process.cwd() })
18
+
19
+ // Sort by directory depth (root to leaves) to match Git's override behavior
20
+ const sortedGitignoreFiles = gitignoreFiles.sort((a, b) => {
21
+ const depthA = a.split(path.sep).length
22
+ const depthB = b.split(path.sep).length
23
+ return depthA - depthB
24
+ })
25
+
26
+ // Convert each .gitignore file into an ESLint ignore config
27
+ const ignoreConfigs = sortedGitignoreFiles.map(file => {
28
+ const fullPath = path.resolve(process.cwd(), file)
29
+ return includeIgnoreFile(fullPath)
30
+ })
12
31
 
13
32
  module.exports = [
33
+ ...ignoreConfigs,
14
34
  {
15
35
  languageOptions: {
16
36
  globals: {
@@ -61,19 +81,19 @@ module.exports = [
61
81
  import: importPlugin,
62
82
  n: nPlugin,
63
83
  promise: promisePlugin,
64
- react: reactPlugin, // Added React plugin
65
- 'react-hooks': reactHooksPlugin // Added React Hooks plugin
84
+ react: reactPlugin,
85
+ 'react-hooks': reactHooksPlugin
66
86
  },
67
87
  processor: 'eslint-env-restore/js',
68
88
  rules: {
69
89
  ...pluginJs.recommended.rules,
70
90
  ...standard.rules,
71
- ...reactPlugin.configs.recommended.rules, // React recommended rules
72
- ...reactHooksPlugin.configs.recommended.rules, // React Hooks recommended rules
91
+ ...reactPlugin.configs.recommended.rules,
92
+ ...reactHooksPlugin.configs.recommended.rules,
73
93
  'no-unused-vars': ['error', { vars: 'local', args: 'none', caughtErrors: 'none', ignoreRestSiblings: true }],
74
- 'react/jsx-uses-react': 'off', // Disabled for React 17+
94
+ 'react/jsx-uses-react': 'off',
75
95
  'react/jsx-uses-vars': 'error',
76
- 'react/react-in-jsx-scope': 'off' // Disabled for React 17+
96
+ 'react/react-in-jsx-scope': 'off'
77
97
  }
78
98
  },
79
99
  // TypeScript (Node.js environment)
@@ -124,20 +144,20 @@ module.exports = [
124
144
  import: importPlugin,
125
145
  n: nPlugin,
126
146
  promise: promisePlugin,
127
- react: reactPlugin, // Added React plugin
128
- 'react-hooks': reactHooksPlugin // Added React Hooks plugin
147
+ react: reactPlugin,
148
+ 'react-hooks': reactHooksPlugin
129
149
  },
130
150
  processor: 'eslint-env-restore/js',
131
151
  rules: {
132
152
  ...tseslint.configs.recommended.rules,
133
153
  ...standard.rules,
134
- ...reactPlugin.configs.recommended.rules, // React recommended rules
135
- ...reactHooksPlugin.configs.recommended.rules, // React Hooks recommended rules
154
+ ...reactPlugin.configs.recommended.rules,
155
+ ...reactHooksPlugin.configs.recommended.rules,
136
156
  'no-unused-vars': ['error', { vars: 'local', args: 'none', caughtErrors: 'none', ignoreRestSiblings: true }],
137
157
  '@typescript-eslint/no-unused-vars': ['error', { vars: 'local', args: 'none', caughtErrors: 'none', ignoreRestSiblings: true }],
138
- 'react/jsx-uses-react': 'off', // Disabled for React 17+
158
+ 'react/jsx-uses-react': 'off',
139
159
  'react/jsx-uses-vars': 'error',
140
- 'react/react-in-jsx-scope': 'off' // Disabled for React 17+
160
+ 'react/react-in-jsx-scope': 'off'
141
161
  }
142
162
  }
143
163
  ]