Skip to content

Commit 8d56d7a

Browse files
committed
break into new package
1 parent c6f92f4 commit 8d56d7a

File tree

13 files changed

+111
-5
lines changed

13 files changed

+111
-5
lines changed

.changeset/ninety-flowers-promise.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
'eslint-config-widen-react': minor
2+
'eslint-config-widen-emotion': minor
33
---
44

5-
Add a new rule that detects conditional statements used on a css prop.
5+
Add a new package for emotion specific rules.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# eslint-config-widen-emotion
2+
3+
Widen's shared ESLint config.
4+
5+
## Installation
6+
7+
```bash
8+
yarn add -D eslint eslint-plugin-emotion
9+
```
10+
11+
## Usage
12+
13+
In your `eslint.config.mjs` file, add the following four entries to your extends
14+
list. If you don't need a specific configuration, simply remove it from the
15+
list.
16+
17+
```js
18+
import emotion from 'eslint-config-widen-emotion'
19+
20+
export default [
21+
...emotion,
22+
...[
23+
// you can specify what to ignore by using the `ignores` key before any other rule
24+
// this will filter out things we dont want this to run on
25+
{ ignores: ['*.test.*'] },
26+
// you can also override rules by specifying the rule and the new value
27+
{ files: ['*.spec.js'], rules: { 'no-unused-vars': 'off' } },
28+
],
29+
]
30+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"author": "Widen",
3+
"dependencies": {
4+
"eslint-config-prettier": "^9.1.0"
5+
},
6+
"description": "Widen's shared ESLint config for Emotion.",
7+
"exports": {
8+
".": "./lib/index.js"
9+
},
10+
"files": [
11+
"lib"
12+
],
13+
"type": "module",
14+
"homepage": "https://github.com/Widen/eslint-config/tree/master/packages/eslint-config-widen-emotion#readme",
15+
"license": "ISC",
16+
"name": "eslint-config-widen-emotion",
17+
"peerDependencies": {
18+
"eslint": ">= 9",
19+
"eslint-plugin-jsx-a11y": ">= 6",
20+
"eslint-plugin-react": ">= 7",
21+
"eslint-plugin-react-hooks": ">= 4"
22+
},
23+
"repository": {
24+
"directory": "packages/eslint-config-widen-emotion",
25+
"type": "git",
26+
"url": "https://github.com/Widen/eslint-config"
27+
},
28+
"version": "1.0.0"
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import noConditionalCssProp from './rules/no-conditional-css-prop.js'
2+
3+
export default {
4+
rules: {
5+
'custom/no-conditional-css-prop': noConditionalCssProp,
6+
},
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import globals from 'globals'
2+
3+
// delete an invalid global that causes error because of the trailing space
4+
const browser = globals.browser
5+
delete browser['AudioWorkletGlobalScope ']
6+
7+
const sharedGlobals = {
8+
...browser,
9+
...globals.es6,
10+
...globals.node,
11+
...globals.jest,
12+
}
13+
14+
export default sharedGlobals
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
declare module 'globals'
2+
declare module 'no-conditional-css-prop'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"extends": "../../tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "lib",
5+
"rootDir": "src",
6+
"module": "esnext",
7+
"esModuleInterop": true,
8+
"target": "es2016"
9+
},
10+
"paths": {
11+
"@/*": ["./src/*"]
12+
}
13+
}

packages/eslint-config-widen-react/src/react.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import jsxA11y from 'eslint-plugin-jsx-a11y'
22
import react from 'eslint-plugin-react'
33
import reactHooks from 'eslint-plugin-react-hooks'
4-
import noConditionalCssProp from './rules/no-conditional-css-prop.js'
54
import sharedGlobals from './sharedGlobals.js'
65

76
const languageOptions = {
@@ -72,7 +71,6 @@ export default [
7271
files: ['*.tsx', '*.{spec,test}.{js,jsx}'],
7372
languageOptions,
7473
rules: {
75-
'custom/no-conditional-css-prop': noConditionalCssProp,
7674
'jsx-a11y/click-events-have-key-events': 'warn',
7775
'jsx-a11y/label-has-associated-control': [
7876
'error',

packages/eslint-config-widen-react/src/types.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ declare module 'eslint-plugin-jsx-a11y'
22
declare module 'eslint-plugin-react'
33
declare module 'eslint-plugin-react-hooks'
44
declare module 'globals'
5-
declare module 'no-conditional-css-prop'

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"references": [
44
{ "path": "packages/eslint-config-widen" },
55
{ "path": "packages/eslint-config-widen-base" },
6+
{ "path": "packages/eslint-config-widen-emotion" },
67
{ "path": "packages/eslint-config-widen-jest" },
78
{ "path": "packages/eslint-config-widen-playwright" },
89
{ "path": "packages/eslint-config-widen-react" },

yarn.lock

+13
Original file line numberDiff line numberDiff line change
@@ -3704,6 +3704,19 @@ __metadata:
37043704
languageName: unknown
37053705
linkType: soft
37063706

3707+
"eslint-config-widen-emotion@workspace:packages/eslint-config-widen-emotion":
3708+
version: 0.0.0-use.local
3709+
resolution: "eslint-config-widen-emotion@workspace:packages/eslint-config-widen-emotion"
3710+
dependencies:
3711+
eslint-config-prettier: ^9.1.0
3712+
peerDependencies:
3713+
eslint: ">= 9"
3714+
eslint-plugin-jsx-a11y: ">= 6"
3715+
eslint-plugin-react: ">= 7"
3716+
eslint-plugin-react-hooks: ">= 4"
3717+
languageName: unknown
3718+
linkType: soft
3719+
37073720
"eslint-config-widen-jest@workspace:packages/eslint-config-widen-jest":
37083721
version: 0.0.0-use.local
37093722
resolution: "eslint-config-widen-jest@workspace:packages/eslint-config-widen-jest"

0 commit comments

Comments
 (0)