Skip to content

Commit

Permalink
feat(oxlint): add oxlint config
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Philibeaux <[email protected]>
  • Loading branch information
philibea committed Nov 29, 2024
1 parent c3ee88b commit 02ff329
Show file tree
Hide file tree
Showing 105 changed files with 825 additions and 448 deletions.
30 changes: 24 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20
node-version: 22
cache: "pnpm"
- run: |
pnpm install
Expand All @@ -36,12 +36,30 @@ jobs:
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20
node-version: 22
cache: "pnpm"
- run: |
pnpm install
pnpm typecheck
oxlint:
runs-on: ubuntu-24.04
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_REMOTE_ONLY: true
steps:
- uses: actions/checkout@v4
- uses: pnpm/[email protected]
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 22
cache: "pnpm"
- run: |
pnpm install
pnpm build
pnpm oxlint -c .oxlintrc.json
lint:
runs-on: ubuntu-24.04
env:
Expand All @@ -53,7 +71,7 @@ jobs:
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20
node-version: 22
cache: "pnpm"
- run: |
pnpm install
Expand All @@ -71,7 +89,7 @@ jobs:
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20
node-version: 22
cache: "pnpm"
- run: |
pnpm install
Expand Down Expand Up @@ -115,7 +133,7 @@ jobs:
# - name: Use Node.js
# uses: actions/[email protected]
# with:
# node-version: 20
# node-version: 22
# cache: 'pnpm'
# - run: pnpm install
# - run: pnpm run build
Expand Down Expand Up @@ -152,7 +170,7 @@ jobs:
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20
node-version: 22
cache: "pnpm"
- run: |
pnpm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fonts-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: pnpm/[email protected]
- uses: actions/[email protected]
with:
node-version: 20
node-version: 22
cache: "pnpm"
- run: pnpm install

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/illustrations-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: pnpm/[email protected]
- uses: actions/[email protected]
with:
node-version: 20
node-version: 22
cache: "pnpm"
- run: pnpm install

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/illustrations-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: pnpm/[email protected]
- uses: actions/[email protected]
with:
node-version: 20
node-version: 22
cache: "pnpm"
- run: pnpm install

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20
node-version: 22
cache: "pnpm"
- run: pnpm install --prod
- name: Check PR title
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20
node-version: 22
cache: "pnpm"
- run: pnpm install
- name: Create Release Pull Request or Publish to npm
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
size:
strategy:
matrix:
node: ["20"]
node: ["22"]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync-design-tokens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 20
node-version: 22
cache: "pnpm"
- run: pnpm install
- name: Generate json files
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,7 @@ vitest.config.ts.*
examples/*/.turbo
packages/*/.turbo
tools/*/.turbo

# typescript
*.tsbuildinfo
.tsbuildinfo
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
save-prefix=""
engine-strict=true
package-manager-strict-version=true
manage-package-manager-versions=true
160 changes: 160 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"categories": {
"correctness": "deny",
"style": "deny",
"suspicious": "deny",
"perf": "deny",
"pedantic": "deny",
"restriction": "deny",
"nursery": "off"
},
"plugins": [
"import",
"node",
"react",
"security",
"n",
"tree_shaking",
"typescript",
"unicorn",
"vitest"
],
"overrides": [
{
"files": ["**/__stories__/**/*.{ts,tsx}"],
"rules": {
"react/jsx-key": "off",
"no-console": "off",
"no-alert": "off"
}
}
],
"rules": {
"@typescript-eslint/ban-tslint-comment": "off",
"@typescript-eslint/consistent-indexed-object-style": "off",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript/no-explicit-any": "warn",
"@typescript-eslint/prefer-enum-initializers": "off",
"@typescript-eslint/prefer-function-type": "off",
"@typescript-eslint/prefer-literal-enum-member": "off",
"@typescript-eslint/prefer-ts-expect-error": "off",
"eslint/default-param-last": "off",
"eslint/max-lines": "off",
"eslint/max-params": "off",
"eslint/no-await-in-loop": "off",
"eslint/no-duplicate-imports": "off",
"eslint/no-empty-function": "off",
"eslint/no-magic-numbers": "off",
"eslint/no-ternary": "off",
"eslint/no-undef": "off",
"eslint/no-undefined": "off",
"eslint/sort-keys": "off",
"eslint/react-in-jsx-scope": "off",
"eslint/no-unused-vars": [
"error",
{
"ignoreRestSiblings": true
}
],
"eslint/require-await": "off",
"eslint/sort-imports": [
"error",
{
"ignoreDeclarationSort": true,
"memberSyntaxSortOrder": ["single", "multiple", "all", "none"]
}
],
"import/export": "off",
"import/import-no-namespace": "off",
"import/max-dependencies": "off",
"import/namespace": "off",
"import/no-default-export": "off",
"import/no-deprecated": "warn",
"import/no-duplicates": "off",
"import/no-unused-modules": "off",
"import/unambiguous": "warn",
"jest/no-conditional-expect": "off",
"jest/no-confusing-set-timeout": "off",
"jest/no-hooks": "off",
"jest/no-restricted-jest-methods": "off",
"jest/no-restricted-matchers": "off",
"jest/no-standalone-expect": "off",
"jest/no-untyped-mock-factory": "off",
"jest/prefer-called-with": "off",
"jest/prefer-comparison-matcher": "off",
"jest/prefer-equality-matcher": "off",
"jest/prefer-expect-resolves": "off",
"jest/prefer-lowercase-title": "off",
"jest/prefer-mock-promise-shorthand": "off",
"jest/prefer-spy-on": "off",
"jest/prefer-strict-equal": "off",
"jest/prefer-to-be": "off",
"jest/prefer-to-contain": "off",
"jest/prefer-to-have-length": "off",
"jest/prefer-todo": "error",
"jest/require-hook": "off",
"jest/require-to-throw-message": "off",
"oxc/no-accumulating-spread": "off",
"oxc/no-async-await": "off",
"oxc/no-barrel-file": "off",
"oxc/no-optional-chaining": "off",
"oxc/no-rest-spread-properties": "off",
"react-perf/jsx-no-jsx-as-prop": "off",
"react-perf/jsx-no-new-array-as-prop": "off",
"react-perf/jsx-no-new-function-as-prop": "off",
"react-perf/jsx-no-new-object-as-prop": "off",
"react/jsx-no-useless-fragment": "off",
"react/exhaustive-deps": "warn",
"react/iframe-missing-sandbox": "warn",
"react/jsx-no-target-blank": "off",
"react/no-set-state": "off",
"react/react-in-jsx-scope": "off",
"unicorn/error-message": "off",
"unicorn/filename-case": "off",
"unicorn/no-anonymous-default-export": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-await-expression-member": "off",
"unicorn/no-await-in-promise-methods": "off",
"unicorn/no-lonely-if": "off",
"unicorn/prefer-set-has": "off",
"unicorn/no-document-cookie": "off",
"unicorn/no-invalid-remove-event-listener": "off",
"unicorn/no-magic-array-flat-depth": "off",
"unicorn/no-negated-condition": "off",
"unicorn/no-new-array": "off",
"unicorn/no-null": "off",
"unicorn/no-object-as-default-parameter": "off",
"unicorn/no-process-exit": "off",
"unicorn/no-single-promise-in-promise-methods": "off",
"unicorn/no-useless-promise-resolve-reject": "off",
"unicorn/no-useless-undefined": "off",
"unicorn/no-zero-fractions": "off",
"unicorn/number-literal-case": "off",
"unicorn/numeric-separators-style": "off",
"unicorn/prefer-add-event-listener": "off",
"unicorn/prefer-array-some": "off",
"unicorn/prefer-blob-reading-methods": "off",
"unicorn/prefer-code-point": "off",
"unicorn/prefer-dom-node-append": "off",
"unicorn/prefer-dom-node-remove": "off",
"unicorn/prefer-logical-operator-over-ternary": "off",
"unicorn/prefer-node-protocol": "off",
"unicorn/prefer-query-selector": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/prefer-string-slice": "off"
},
"settings": {
"jsx-a11y": {
"components": {
"polymorphicPropName": "as"
}
},
"react": {}
}
}
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { FlatCompat } from '@eslint/eslintrc'
import scwEmotion from '@scaleway/eslint-config-react/emotion'
import scwJavascript from '@scaleway/eslint-config-react/javascript'
import scwTypescript from '@scaleway/eslint-config-react/typescript'
import oxlint from 'eslint-plugin-oxlint'
import globals from 'globals'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
Expand Down Expand Up @@ -148,4 +149,5 @@ export default [
'react/jsx-props-no-spreading': 'off',
},
},
oxlint.configs['flat/all'],
]
2 changes: 1 addition & 1 deletion examples/next-advanced/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ const nextConfig = () => {
return config
}

module.exports = nextConfig()
export default nextConfig()
2 changes: 1 addition & 1 deletion examples/next-advanced/src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class MyDocument extends Document {
return (
<Html>
<Head>
<meta charSet="UTF-8" />
<meta charSet="utf8" />
<meta
name="description"
content="Scaleway Open Source Component Library"
Expand Down
2 changes: 1 addition & 1 deletion examples/next-login/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ const nextConfig = () => {
return config
}

module.exports = nextConfig()
export default nextConfig()
4 changes: 2 additions & 2 deletions examples/next-login/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ThemeProvider, Global, css } from '@emotion/react'
import { Global, ThemeProvider, css } from '@emotion/react'
import { Button } from '@ultraviolet/ui'
import { darkTheme, theme, normalize } from '@ultraviolet/ui'
import { darkTheme, normalize, theme } from '@ultraviolet/ui'
import type { AppProps } from 'next/app'
import { useState } from 'react'

Expand Down
2 changes: 1 addition & 1 deletion examples/next-login/src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class MyDocument extends Document {
return (
<Html>
<Head>
<meta charSet="UTF-8" />
<meta charSet="utf8" />
<meta
name="description"
content="Scaleway Open Source Component Library"
Expand Down
8 changes: 5 additions & 3 deletions examples/next-login/src/pages/home/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from 'react'
import LogIn from './login'
import SignUp from './signup'
import { SwitchButton, Stack } from '@ultraviolet/ui'
import { Stack, SwitchButton } from '@ultraviolet/ui'
import styled from '@emotion/styled'

const StyledSwitchButton = styled(SwitchButton)`
Expand All @@ -14,11 +14,13 @@ const StyledPage = styled(Stack)`
const Content = (props: { tab: string }) => {
let tabLoaded = undefined
switch (props.tab) {
case 'login':
case 'login': {
tabLoaded = <LogIn />
break
default:
}
default: {
tabLoaded = <SignUp />
}
}
return tabLoaded
}
Expand Down
Loading

0 comments on commit 02ff329

Please sign in to comment.