-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
111 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { base } from 'eslint-config-ali'; | ||
|
||
export default [...base, { ignores: ['fixtures'] }]; | ||
export default [...base, { ignores: ['**/bad/'] }]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { base } from './dist'; | ||
|
||
export default [...base, { ignores: ['fixtures'] }]; | ||
export default [...base, { ignores: ['bad/'] }]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
export { default as base } from './presets/base'; | ||
export { default as react } from './presets/react'; | ||
export { default as vue } from './presets/vue'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
packages/eslint-config-ali/test/use-babel-eslint.test.xxx.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.js | ||
*.jsx | ||
*.ts | ||
*.tsx |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions
12
...ig-ali/test/fixtures/use-babel-eslint.jsx → ...config-ali/tests/bad/use-babel-eslint.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useEffect, useMemo, useState } from 'react'; | ||
|
||
export function GoodReactHooks() { | ||
const [foo, setFoo] = useState('foo'); | ||
const [bar, setBar] = useState('bar'); | ||
|
||
const foobar = useMemo(() => foo + bar, [foo, bar]); | ||
|
||
useEffect(() => { | ||
setFoo('notfoo'); | ||
setBar('notbar'); | ||
}, []); | ||
|
||
return <div>{foobar}</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useEffect, useMemo, useState } from 'react'; | ||
|
||
export function GoodReactHooks() { | ||
const [foo, setFoo] = useState('foo'); | ||
const [bar, setBar] = useState('bar'); | ||
|
||
const foobar = useMemo(() => foo + bar, [foo, bar]); | ||
|
||
useEffect(() => { | ||
setFoo('notfoo'); | ||
setBar('notbar'); | ||
}, []); | ||
|
||
return <div>{foobar}</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { ESLint } from 'eslint'; | ||
import path from 'node:path'; | ||
import { react } from '../src'; | ||
|
||
it('should lint jsx files', async () => { | ||
const filePath = path.join(import.meta.dirname, './bad/use-babel-eslint.jsx'); | ||
|
||
const cli = new ESLint({ | ||
baseConfig: react, | ||
overrideConfigFile: true, | ||
ignore: true, | ||
}); | ||
|
||
const results = await cli.lintFiles([filePath]); | ||
const { messages, errorCount, fatalErrorCount, warningCount } = results[0]; | ||
|
||
expect(fatalErrorCount).toBe(0); | ||
expect(errorCount).toBe(20); | ||
expect(warningCount).toBe(7); | ||
|
||
const errorReportedByReactPlugin = messages.filter((result) => { | ||
return ( | ||
(result.ruleId && result.ruleId.startsWith('react/')) || | ||
result.ruleId.startsWith('react-hooks/') | ||
); | ||
}); | ||
|
||
expect(errorReportedByReactPlugin.length).toBe(3); | ||
}); | ||
|
||
describe('good', () => { | ||
['react-hooks.jsx', 'react-hooks.tsx'].forEach((file) => { | ||
it(`should pass lint for ${file}`, async () => { | ||
const cli = new ESLint({ | ||
baseConfig: react, | ||
overrideConfigFile: true, | ||
ignore: true, | ||
}); | ||
|
||
const results = await cli.lintFiles(path.join(import.meta.dirname, 'good', file)); | ||
|
||
expect(results[0].fatalErrorCount).toBe(0); | ||
expect(results[0].errorCount).toBe(0); | ||
expect(results[0].warningCount).toBe(0); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ESLint } from 'eslint'; | ||
import path from 'path'; | ||
import { base } from '../src'; | ||
|
||
// Lint the package source code | ||
it('should pass self lint', async () => { | ||
const cli = new ESLint({ | ||
baseConfig: base, | ||
overrideConfigFile: true, | ||
ignore: true, | ||
}); | ||
|
||
const reports = await cli.lintFiles([path.join(import.meta.dirname, '../src')]); | ||
expect(reports.reduce((count, { errorCount }) => errorCount + count, 0)).toBe(0); | ||
}); |
File renamed without changes.
File renamed without changes.
Oops, something went wrong.