https://github.com/acdh-oeaw/eslint-config

Shared configuration presets for ESLint

https://github.com/acdh-oeaw/eslint-config

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (4.7%) to scientific vocabulary

Keywords

frontend
Last synced: 6 months ago · JSON representation

Repository

Shared configuration presets for ESLint

Basic Info
  • Host: GitHub
  • Owner: acdh-oeaw
  • License: mit
  • Language: JavaScript
  • Default Branch: main
  • Homepage:
  • Size: 1.16 MB
Statistics
  • Stars: 0
  • Watchers: 5
  • Forks: 0
  • Open Issues: 1
  • Releases: 310
Topics
frontend
Created about 3 years ago · Last pushed 6 months ago
Metadata Files
Readme License Codeowners

readme.md

acdh-oeaw eslint configs

Shared configuration presets for eslint.

  • @acdh-oeaw/eslint-config: recommended base config for typescript projects
  • @acdh-oeaw/eslint-config-astro: additional recommended config for Astro projects
  • @acdh-oeaw/eslint-config-mdx: additional recommended config for .mdx files
  • @acdh-oeaw/eslint-config-next: additional recommended config for Next.js projects
  • @acdh-oeaw/eslint-config-node: additional recommended config for Node.js projects
  • @acdh-oeaw/eslint-config-nuxt: additional recommended config for Nuxt 3 projects
  • @acdh-oeaw/eslint-config-playwright: additional recommended config for Playwright projects
  • @acdh-oeaw/eslint-config-react: additional recommended config for React projects
  • @acdh-oeaw/eslint-config-solid: additional recommended config for Solid projects
  • @acdh-oeaw/eslint-config-storybook: additional recommended config for Storybook projects
  • @acdh-oeaw/eslint-config-tailwindcss: additional recommended config for Tailwind CSS
  • @acdh-oeaw/eslint-config-vue: additional recommended config for Vue 3 projects

How to install

```bash npm install -D eslint globals @acdh-oeaw/eslint-config

additional configs

npm install -D @acdh-oeaw/eslint-config-react @acdh-oeaw/eslint-config-next ```

Add the configs to eslint.config.ts:

```ts import baseConfig from "@acdh-oeaw/eslint-config"; import nextConfig from "@acdh-oeaw/eslint-config-next"; import reactConfig from "@acdh-oeaw/eslint-config-react"; import { config } from "typescript-eslint";

export default = config(baseConfig, reactConfig, nextConfig); ```

Optionally, enable additional rules:

```ts import baseConfig from "@acdh-oeaw/eslint-config"; import nextConfig from "@acdh-oeaw/eslint-config-next"; import reactConfig from "@acdh-oeaw/eslint-config-react"; import gitignore from "eslint-config-flat-gitignore"; import { config } from "typescript-eslint";

export default config = ( gitignore({ strict: false }), baseConfig, reactConfig, nextConfig, { rules: { "arrow-body-style": ["error", "always"], "prefer-arrow-callback": ["error", { allowNamedFunctions: true }], "@typescript-eslint/explicit-module-boundary-types": "error", "@typescript-eslint/require-array-sort-compare": "error", "@typescript-eslint/strict-boolean-expressions": "error", "react/jsx-sort-props": ["error", { reservedFirst: true }], }, }, ); ```

How to install in Nuxt

For nuxt projects, you need to use the @nuxt/eslint module, so eslint understands nuxt auto-imports.

bash npx nuxi module add eslint

In nuxt.config.ts, configure the module for "standalone" mode, since we provide our own config:

ts export default defineNuxtConfig({ modules: ["@nuxt/eslint"], eslint: { config: { standalone: true, }, }, });

Pass our config to withNuxt in eslint.config.ts:

```ts import baseConfig from "@acdh-oeaw/eslint-config"; import nuxtConfig from "@acdh-oeaw/eslint-config-nuxt"; import vueConfig from "@acdh-oeaw/eslint-config-vue"; import { config } from "typescript-eslint";

import { withNuxt } from "./.nuxt/eslint.config.mjs";

export default withNuxt(config(baseConfig, vueConfig, nuxtConfig)); ```

How to set up with Tailwind CSS

The tailwindcss config requires additional configuration:

```ts import { resolve } from "node:path";

import baseConfig from "@acdh-oeaw/eslint-config"; import tailwindConfig from "@acdh-oeaw/eslint-config-tailwindcss"; import { config } from "typescript-eslint";

export default config(baseConfig, tailwindConfig, { settings: { tailwindcss: { /** Absolute path to css file with @import "tailwindcss"; */ config: resolve("./styles/index.css"), }, }, }); ```

How to use

Add a script to package.json:

json { "lint:check": "eslint . --cache", "lint:fix": "npm run lint:check -- --fix" }

You can then run npm run lint:check to lint, and npm run lint:fix to fix auto-fixable errors.

Note that --cache is not officially supported with typescript-eslint's type-aware rules, because eslint processes single files, but type checking requires whole-program analysis. Enabling caching means you probably need to restart your editor's eslint plugin more often.

How to run with Git hooks

bash npm install -D lint-staged npm-run-all2 simple-git-hooks

To run the linter on every Git commit, add the following to package.json:

json { "scripts": { "format:check": "prettier . --cache --check", "format:fix": "npm run format:check -- --write", "lint:check": "eslint . --cache", "lint:fix": "npm run lint:check -- --fix", "prepare": "npm run setup", "setup": "is-ci || simple-git-hooks", "validate": "run-p format:check lint:check" }, "lint-staged": { "*.@(cjs|js|mjs|ts|tsx|vue)": ["eslint --cache --fix", "prettier --cache --write"], "*": "prettier --cache --ignore-unknown --write" }, "simple-git-hooks": { "pre-commit": "npx lint-staged", "pre-push": "npm run validate" } }

Ignore .gitignore files

Either use includeIgnoreFile from @eslint/compat, or eslint-config-flat-gitignore.

Editor integrations

VS Code

Install the VS Code vscode-eslint plugin by pressing Ctrl+P and pasting the following command:

ext install dbaeumer.vscode-eslint

Also, make sure to add vscode-eslint to the list of recommended plugins for your project in .vscode/extensions.json:

json { "recommendations": ["dbaeumer.vscode-eslint"] }

You may also want to enable "Fix auto-fixable errors on Save" in .vscode/settings.json:

json { "editor.codeActionsOnSave": { "source.fixAll": true } }

Troubleshooting

When using pnpm, you may need to add the following to .npmrc to make the VS Code eslint extension work correctly:

```

https://github.com/microsoft/vscode-eslint/issues/1986

public-hoist-pattern[]=eslint-plugin ```

Owner

  • Name: Austrian Centre for Digital Humanities & Cultural Heritage
  • Login: acdh-oeaw
  • Kind: organization
  • Email: acdh@oeaw.ac.at
  • Location: Vienna, Austria

GitHub Events

Total
  • Release event: 98
  • Delete event: 20
  • Push event: 55
  • Pull request event: 38
  • Create event: 35
Last Year
  • Release event: 98
  • Delete event: 20
  • Push event: 55
  • Pull request event: 38
  • Create event: 35

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 2
  • Total pull requests: 102
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 days
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.01
  • Merged pull requests: 89
  • Bot issues: 1
  • Bot pull requests: 97
Past Year
  • Issues: 2
  • Pull requests: 36
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 days
  • Issue authors: 2
  • Pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.03
  • Merged pull requests: 29
  • Bot issues: 1
  • Bot pull requests: 34
Top Authors
Issue Authors
  • github-actions[bot] (1)
  • kkukelka (1)
Pull Request Authors
  • github-actions[bot] (97)
  • stefanprobst (4)
  • kkukelka (1)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/release.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v3 composite
  • changesets/action v1 composite
  • pnpm/action-setup v2 composite
package.json npm
  • @changesets/changelog-github ^0.4.8 development
  • @changesets/cli ^2.26.0 development
  • prettier ^2.8.1 development
  • typescript ^4.9.4 development
packages/base/package.json npm
  • @typescript-eslint/eslint-plugin ^5.48.0
  • @typescript-eslint/parser ^5.48.0
  • eslint-config-prettier ^8.6.0
  • eslint-import-resolver-typescript ^3.5.2
  • eslint-plugin-import ^2.26.0
  • eslint-plugin-simple-import-sort ^8.0.0
  • eslint-plugin-typescript-enum ^2.1.0
packages/vue/package.json npm
  • eslint-plugin-vue ^9.8.0
  • eslint-plugin-vuejs-accessibility ^2.0.0
pnpm-lock.yaml npm
  • 250 dependencies