-
Notifications
You must be signed in to change notification settings - Fork 1
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
24 changed files
with
1,853 additions
and
105 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'eslint-config-widen': patch | ||
--- | ||
|
||
Fix config and update examples. |
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
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 @@ | ||
/** @type {import('@jest/types').Config.ProjectConfig} */ | ||
module.exports = { | ||
testPathIgnorePatterns: ['<rootDir>/packages/eslint-playground/'], | ||
} |
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
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,25 +1,7 @@ | ||
// index.js or index.mjs inside eslint-config-widen package | ||
import { Linter } from 'eslint' | ||
import baseConfig from './index.js' | ||
import jestConfig from './jest.js' | ||
import playwrightConfig from './playwright.js' | ||
import reactConfig from './react.js' | ||
import typescriptConfig from './typescript.js' | ||
import base from './base.js' | ||
import jest from './jest.js' | ||
import playwright from './playwright.js' | ||
import react from './react.js' | ||
import typescript from './typescript.js' | ||
|
||
export interface EslintConfig { | ||
base: Linter.FlatConfig[] | ||
typescript: Linter.FlatConfig[] | ||
react: Linter.FlatConfig[] | ||
playwright: Linter.FlatConfig[] | ||
jest: Linter.FlatConfig[] | ||
} | ||
|
||
const configs = { | ||
base: baseConfig, | ||
jest: jestConfig, | ||
playwright: playwrightConfig, | ||
react: reactConfig, | ||
typescript: typescriptConfig, | ||
} as unknown as EslintConfig | ||
|
||
export default configs | ||
export { base, jest, playwright, react, typescript } |
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
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,14 @@ | ||
import globals from 'globals' | ||
|
||
// delete an invalid global that causes error because of the trailing space | ||
const browser = globals.browser | ||
delete browser['AudioWorkletGlobalScope '] | ||
|
||
const sharedGlobals = { | ||
...browser, | ||
...globals.es6, | ||
...globals.node, | ||
...globals.jest, | ||
} | ||
|
||
export default sharedGlobals |
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
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,11 @@ | ||
# eslint-playground | ||
|
||
A sample project that uses the eslint-config-widen to ensure things are working. | ||
Included is a file to correspond with each eslint plugin type which will throw | ||
lint errors. | ||
|
||
### To test updates: | ||
|
||
1. Run `yarn ts` in the base package any time you change the code in the | ||
eslint-config-widen to regen the output. | ||
2. In the eslint-playground package run `yarn lint` |
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,11 @@ | ||
import { expect, test } from 'fixtures' | ||
|
||
/** | ||
* Basic test with errors to test playwright eslint config | ||
*/ | ||
test.describe('Sample', () => { | ||
test('should pass', async ({ page }) => { | ||
console.log('wow') | ||
await page.goto('https://playwright.dev/') | ||
}) | ||
}) |
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,16 @@ | ||
import { base, react, jest, playwright, typescript } from 'eslint-config-widen' | ||
|
||
export default [ | ||
...base, | ||
...typescript, | ||
...react, | ||
...[ | ||
// you can specify what to ignore by using the `ignores` key before any other rule | ||
// this will filter out things we dont want this to run on | ||
{ ignores: ['*.test.*'] }, | ||
...jest, | ||
// you can also override rules by specifying the rule and the new value | ||
{ files: ['*.spec.js'], rules: { 'jest/expect-expect': 'off' } }, | ||
], | ||
...[{ files: ['e2e/**'] }, ...playwright], | ||
] |
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,6 @@ | ||
/** | ||
* Empty test to test jest eslint config errors | ||
*/ | ||
it('should render', async () => { | ||
console.log('hey') | ||
}) |
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,10 @@ | ||
/** | ||
* contains some failing rules to test base eslint config | ||
*/ | ||
export function test(input = 'test', hey) { | ||
try { | ||
console.log('test') | ||
} catch (e) { | ||
throw e | ||
} | ||
} |
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,24 @@ | ||
{ | ||
"name": "eslint-playground", | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"lint": "eslint ." | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.24.8", | ||
"@babel/eslint-parser": "^7.24.8", | ||
"eslint": "^9.6.0", | ||
"eslint-config-widen": "workspace:^", | ||
"eslint-plugin-jest": "^28.6.0", | ||
"eslint-plugin-jsx-a11y": "^6.9.0", | ||
"eslint-plugin-playwright": "^1.6.2", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"eslint-plugin-react": "^7.34.3", | ||
"eslint-plugin-react-hooks": "^4.6.2", | ||
"eslint-plugin-sort": "^3.0.2", | ||
"eslint-plugin-widen": "workspace:^" | ||
}, | ||
"dependencies": { | ||
"react": "^18.3.1" | ||
} | ||
} |
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,6 @@ | ||
import React from 'react' | ||
|
||
export function test(unused, unused) { | ||
console.log('wow') | ||
return <button>Test</button> | ||
} |
Oops, something went wrong.