Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,32 +45,16 @@ jobs:
- run: yarn install
- run: yarn build:web
- run: yarn check-graphql-documents
eslint:
name: eslint
lint:
name: lint
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
cache: yarn
- run: yarn install
- run: mkdir -p /home/runner/.local/bin
- run: echo "#!/bin/sh" > /home/runner/.local/bin/eslint
- run: echo "yarn run eslint \$@" >> /home/runner/.local/bin/eslint
- run: cat /home/runner/.local/bin/eslint
- run: chmod +x /home/runner/.local/bin/eslint
- run: eslint --version
# Pinned below v1.35.0: that release switched the action's internal eslint
# invocation from `npx --no-install -c "eslint ..."` (a shell string, which
# respects $PATH and finds the shim above) to `npx --no-install eslint ...`
# (bare argv form, which does not). Since this repo uses Yarn PnP (no
# node_modules/.bin), the bare form can't resolve eslint locally and npx
# falls back to fetching eslint's latest release from the registry, which
# --no-install then refuses to do. See reviewdog/action-eslint#258.
- uses: reviewdog/action-eslint@v1.36.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
eslint_flags: 'app/javascript test/javascript schema.graphql'
- run: yarn oxlint app/javascript test/javascript --format=github
- run: yarn lint:graphql
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ cookbooks
/.threeman

# eslint keeps a local cache of what's changed
/.eslintcache

# Hello vscode users
/.vscode
Expand Down
333 changes: 333 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,333 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": [
"react",
"typescript",
"vitest",
"jsx-a11y",
"import",
"unicorn"
],
"categories": {
"correctness": "off"
},
"env": {
"builtin": true,
"es6": true,
"amd": true,
"browser": true,
"node": true
},
"globals": {
"$": "off",
"jQuery": "off",
"suite": "writable",
"test": "writable",
"describe": "writable",
"it": "writable",
"expectTypeOf": "writable",
"assertType": "writable",
"expect": "writable",
"assert": "writable",
"chai": "writable",
"vitest": "writable",
"vi": "writable",
"beforeAll": "writable",
"afterAll": "writable",
"beforeEach": "writable",
"afterEach": "writable",
"onTestFailed": "writable",
"onTestFinished": "writable"
},
"ignorePatterns": [
"node_modules",
"public",
"config",
"doc-site",
"cms_content_sets",
".yarn",
".react-router",
"coverage",
"build/framework",
"**/*.generated.ts",
"**/*{.,-}min.js"
],
"rules": {
"constructor-super": "error",
"for-direction": "error",
"getter-return": "error",
"no-async-promise-executor": "error",
"no-case-declarations": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-binary-expression": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-dupe-class-members": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-empty-static-block": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-import-assign": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-new-native-nonconstructor": "error",
"no-nonoctal-decimal-escape": "error",
"no-obj-calls": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-setter-return": "error",
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-labels": "error",
"no-unused-private-class-members": "error",
"no-unused-vars": [
"error",
{
"ignoreRestSiblings": true
}
],
"no-useless-backreference": "error",
"no-useless-catch": "error",
"no-useless-escape": "error",
"no-with": "error",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
"react/display-name": "error",
"react/jsx-key": "error",
"react/jsx-no-comment-textnodes": "error",
"react/jsx-no-duplicate-props": "error",
"react/jsx-no-target-blank": "error",
"react/jsx-no-undef": "error",
"react/no-children-prop": "error",
"react/no-danger-with-children": "error",
"react/no-direct-mutation-state": "error",
"react/no-find-dom-node": "error",
"react/no-is-mounted": "error",
"react/no-render-return-value": "error",
"react/no-string-refs": "error",
"react/no-unescaped-entities": "error",
"react/no-unknown-property": "error",
"no-array-constructor": "error",
"no-unused-expressions": "error",
"vitest/expect-expect": "error",
"vitest/no-commented-out-tests": "error",
"vitest/no-conditional-expect": "error",
"vitest/no-disabled-tests": "warn",
"vitest/no-focused-tests": "error",
"vitest/no-identical-title": "error",
"vitest/no-import-node-test": "error",
"vitest/no-interpolation-in-snapshots": "error",
"vitest/no-mocks-import": "error",
"vitest/no-standalone-expect": "error",
"vitest/no-unneeded-async-expect-function": "error",
"vitest/prefer-called-exactly-once-with": "error",
"vitest/require-local-test-context-for-concurrent-snapshots": "error",
"vitest/valid-describe-callback": "error",
"vitest/valid-expect": "error",
"vitest/valid-expect-in-promise": "error",
"vitest/valid-title": "error",
"no-underscore-dangle": [
"error",
{
"allow": [
"__typename"
]
}
],
"jsx-a11y/label-has-associated-control": [
"error",
{
"labelAttributes": [
"inputId"
],
"controlComponents": [
"Select"
]
}
],
"jsx-a11y/control-has-associated-label": [
"error",
{
"ignoreElements": [
"tr",
"th",
"td"
]
}
],
"no-restricted-imports": [
"error",
"graphql-tag"
],
"prefer-arrow-callback": [
"error",
{
"allowNamedFunctions": true
}
],
"react/rules-of-hooks": "error",
"react/exhaustive-deps": "warn",
"react/static-components": "error",
"react/use-memo": "error",
"react/preserve-manual-memoization": "error",
"react/incompatible-library": "warn",
"react/immutability": "error",
"react/globals": "error",
"react/refs": "error",
"react/set-state-in-effect": "error",
"react/error-boundaries": "error",
"react/purity": "error",
"react/set-state-in-render": "error",
"react/unsupported-syntax": "warn",
"typescript/ban-ts-comment": "error",
"typescript/no-duplicate-enum-values": "error",
"typescript/no-empty-object-type": "error",
"typescript/no-explicit-any": "error",
"typescript/no-extra-non-null-assertion": "error",
"typescript/no-misused-new": "error",
"typescript/no-namespace": "error",
"typescript/no-non-null-asserted-optional-chain": "error",
"typescript/no-require-imports": "error",
"typescript/no-this-alias": "error",
"typescript/no-unnecessary-type-constraint": "error",
"typescript/no-unsafe-declaration-merging": "error",
"typescript/no-unsafe-function-type": "error",
"typescript/no-wrapper-object-types": "error",
"typescript/prefer-as-const": "error",
"typescript/prefer-namespace-keyword": "error",
"typescript/triple-slash-reference": "error"
},
"overrides": [
{
"files": [
"**/*.ts",
"**/*.tsx",
"**/*.mts",
"**/*.cts"
],
"rules": {
"constructor-super": "off",
"getter-return": "off",
"no-class-assign": "off",
"no-const-assign": "off",
"no-dupe-class-members": "off",
"no-dupe-keys": "off",
"no-func-assign": "off",
"no-import-assign": "off",
"no-new-native-nonconstructor": "off",
"no-obj-calls": "off",
"no-redeclare": "off",
"no-setter-return": "off",
"no-this-before-super": "off",
"no-unreachable": "off",
"no-unsafe-negation": "off",
"no-var": "error",
"no-with": "off",
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error"
}
},
{
"files": [
"app/javascript/**/*.tsx"
],
"rules": {
"i18next/no-literal-string": [
"warn",
{
"mode": "all",
"callees": {
"include": [
"usePageTitle"
]
},
"object-properties": {
"exclude": [
"id",
"accessor",
"defaultVisibleColumns",
"__typename",
"payment_options",
"path"
]
},
"jsx-attributes": {
"include": [
"title",
"aria-label",
"caption",
"placeholder",
"label",
"helpText",
"stringError",
"alt"
]
},
"should-validate-template": true
}
]
},
"jsPlugins": [
"eslint-plugin-i18next"
]
},
{
"files": [
"**/*.ts",
"**/*.tsx"
],
"rules": {
"no-restricted-imports": [
"error",
{
"paths": [
"graphql-tag",
"prop-types",
{
"name": "@apollo/client",
"importNames": [
"gql"
],
"message": "Please define GraphQL operations in .graphql files and use graphql-code-generator to generate hooks"
},
{
"name": "i18next",
"importNames": [
"t"
],
"message": "Please import useTranslation from react-i18next instead"
}
]
}
],
"typescript/no-extra-non-null-assertion": [
"error"
]
}
}
]
}
4 changes: 2 additions & 2 deletions app/javascript/BuiltInFormControls/AddFileModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import SelectWithLabel from './SelectWithLabel';
import FileUploadForm from '../BuiltInForms/FileUploadForm';
import { ActiveStorageAttachment } from '../graphqlTypes.generated';
import { Blob } from '@rails/activestorage';
import { useLazyQuery } from "@apollo/client/react";
import { useLazyQuery } from '@apollo/client/react';

export type AddFileModalProps = {
visible: boolean;
Expand All @@ -20,7 +20,7 @@ export type AddFileModalProps = {

export default function AddFileModal({ visible, existingFiles, addBlob, fileChosen, close }: AddFileModalProps) {
const { t } = useTranslation();
const [loadData, { called, data, loading, error }] = useLazyQuery(CmsFilesAdminQueryDocument);
const [loadData, { called, loading, error }] = useLazyQuery(CmsFilesAdminQueryDocument);
const [file, setFile] = useState<ActiveStorageAttachment | null>(null);

const uploadedFile = async (blob: Blob, newFile: File) => {
Expand Down
Loading
Loading