-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
49ab9c6
commit ba52938
Showing
18 changed files
with
481 additions
and
340 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
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,19 +1,26 @@ | ||
{ | ||
"version": "0.0.2", | ||
"private": true, | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"packageManager": "pnpm@8.6.12", | ||
"scripts": { | ||
"lint": "eslint . --config=packages/eslint-config/index.cjs", | ||
"lint": "eslint . --config=packages/eslint-config-ts/index.cjs", | ||
"release": "pnpm test && bumpp -r && pnpm publish -r --no-git-checks", | ||
"test": "pnpm lint && vitest run" | ||
}, | ||
"devDependencies": { | ||
"@benny123tw/eslint-config-ts": "workspace:*", | ||
"bumpp": "^9.2.0", | ||
"eslint": "^8.43.0", | ||
"vitest": "^0.32.2", | ||
"eslint": "^8.47.0", | ||
"prettier": "^3.0.2", | ||
"vitest": "^0.34.3", | ||
"vue": "^3.3.4" | ||
}, | ||
"packageManager": "pnpm@8.6.2", | ||
"version": "0.0.2" | ||
"eslintConfig": { | ||
"extends": [ | ||
"@benny123tw/eslint-config-ts" | ||
] | ||
} | ||
} |
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,29 @@ | ||
const prettierRules = require('@benny123tw/prettier-config') | ||
|
||
/** @type {import('eslint').ESLint.ConfigData} */ | ||
const config = { | ||
extends: ['@antfu/eslint-config-ts', 'plugin:prettier/recommended'], | ||
plugins: ['cypress'], | ||
rules: { | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
...prettierRules, | ||
}, | ||
], | ||
|
||
// See: https://typescript-eslint.io/rules/brace-style/ | ||
'brace-style': 'off', | ||
'@typescript-eslint/brace-style': 'error', | ||
|
||
// cypress | ||
'cypress/no-assigning-return-values': 'error', | ||
'cypress/no-unnecessary-waiting': 'warn', | ||
'cypress/assertion-before-screenshot': 'warn', | ||
'cypress/no-force': 'off', | ||
'cypress/no-async-tests': 'error', | ||
'cypress/no-pause': 'error', | ||
}, | ||
} | ||
|
||
module.exports = config |
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,29 @@ | ||
{ | ||
"name": "@benny123tw/eslint-config-cypress", | ||
"version": "0.0.2", | ||
"description": "ESLint Cypress config for Benny personal usage", | ||
"author": "Benny Yen <benny123tw@gmail.com>", | ||
"license": "MIT", | ||
"homepage": "https://github.com/benny123tw/eslint-config", | ||
"repository": "https://github.com/benny123tw/eslint-config.git", | ||
"exports": { | ||
".": "./index.cjs" | ||
}, | ||
"main": "index.cjs", | ||
"files": [ | ||
"index.cjs" | ||
], | ||
"peerDependencies": { | ||
"eslint": ">=8.44.0", | ||
"typescript": ">=3.9" | ||
}, | ||
"dependencies": { | ||
"@antfu/eslint-config-ts": "^0.41.0", | ||
"@benny123tw/prettier-config": "workspace:*", | ||
"eslint-plugin-cypress": "^2.14.0" | ||
}, | ||
"devDependencies": { | ||
"@types/eslint": "^8.44.2", | ||
"eslint": "^8.47.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,20 @@ | ||
import { fileURLToPath } from 'node:url' | ||
import { describe, expect, it } from 'vitest' | ||
import { ESLint } from 'eslint' | ||
|
||
describe('eslint-config', () => { | ||
it('loads config in eslint to validate all rule syntax is correct', async () => { | ||
const cli = new ESLint({ | ||
useEslintrc: false, | ||
overrideConfigFile: fileURLToPath(new URL('../index.cjs', import.meta.url)), | ||
}) | ||
|
||
const code = "const foo = 1\nconst bar = function () {}\nbar(foo)\nconst dummy = 'test'\n" | ||
|
||
const [{ errorCount }] = await cli.lintText(code, { filePath: 'test.ts' }) | ||
expect(errorCount).toEqual(0) | ||
|
||
const rules = await cli.calculateConfigForFile('test.ts') | ||
expect(rules.plugins).toContain('cypress') | ||
}) | ||
}) |
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
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,9 +1,9 @@ | ||
/** @type {import('prettier').Options} */ | ||
const config = { | ||
semi: false, | ||
singleQuote: true, | ||
tabWidth: 2, | ||
printWidth: 100 | ||
semi: false, | ||
singleQuote: true, | ||
tabWidth: 2, | ||
printWidth: 100, | ||
} | ||
|
||
module.exports = config; | ||
module.exports = config |
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 @@ | ||
declare const config: import('prettier').Options |
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
Oops, something went wrong.