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
120 changes: 0 additions & 120 deletions .eslintrc.json

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
runs-on: ubuntu-latest
env:
CURSORLESS_REPO_ROOT: ${{ github.workspace }}
ESLINT_USE_FLAT_CONFIG: false

steps:
- name: Checkout repository
Expand Down
154 changes: 154 additions & 0 deletions eslint.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import eslintJs from "@eslint/js";
import prettierConfig from "eslint-config-prettier/flat";
import importPlugin from "eslint-plugin-import";
import mochaPlugin from "eslint-plugin-mocha";
import unicornPlugin from "eslint-plugin-unicorn";
import unusedImportsPlugin from "eslint-plugin-unused-imports";
import eslintTs, { type ConfigWithExtends } from "typescript-eslint";
import { commonConfig } from "./packages/common/eslint.config.mts";
import { cursorlessEngineConfig } from "./packages/cursorless-engine/eslint.config.mts";
import { cursorlessOrgConfig } from "./packages/cursorless-org/eslint.config.mts";
import { cursorlessVscodeConfig } from "./packages/cursorless-vscode/eslint.config.mts";

const ignoresConfig: ConfigWithExtends = {
ignores: [
"**/generated/**/*",
"**/out/**/*",
"**/dist/**/*",
"**/build/**/*",
"**/vendor/**/*",
"**/.next/**/*",
"**/.docusaurus/**/*",
"**/eslint.config.mts",
"data/playground/**/*",
],
};

const rootConfig: ConfigWithExtends = {
plugins: {
"unused-imports": unusedImportsPlugin,
import: importPlugin,
unicorn: unicornPlugin,
mocha: mochaPlugin,
},

languageOptions: {
parser: eslintTs.parser,
ecmaVersion: 6,
sourceType: "module",
parserOptions: {
project: true,
},
},

settings: {
"import/resolver": {
typescript: {
// Always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
alwaysTryTypes: true,
project: ["tsconfig.json", "packages/*/tsconfig.json"],
},
},
},

rules: {
"import/no-relative-packages": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-assertions": [
"error",
{
assertionStyle: "as",
},
],
"@typescript-eslint/naming-convention": [
"error",
{
selector: ["objectLiteralProperty"],
format: ["camelCase"],
filter: {
regex: "[.]",
match: false,
},
},
],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"unused-imports/no-unused-imports": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
curly: "error",
eqeqeq: [
"error",
"always",
{
null: "never",
},
],
"no-constant-condition": [
"error",
{
checkLoops: false,
},
],
"no-restricted-syntax": [
"error",
"MemberExpression[object.property.name='constructor'][property.name='name']",
],
"no-throw-literal": "error",
semi: "off",
"unicorn/prefer-module": "error",
"mocha/no-pending-tests": "error",
"mocha/no-exclusive-tests": "error",
},
};

const tsxConfig: ConfigWithExtends = {
files: ["**/*.tsx"],
rules: {
"@typescript-eslint/naming-convention": [
"error",
{
selector: ["function"],
format: ["PascalCase", "camelCase"],
},
],
},
};

const disabledTypeCheckConfig: ConfigWithExtends = {
files: [
"**/jest.config.ts",
"**/docusaurus.config.mts",
"**/mdx-components.tsx",
"typings/**",
"**/*.js",
"**/*.mjs",
],

extends: [eslintTs.configs.disableTypeChecked],
};

export default eslintTs.config(
ignoresConfig,
eslintJs.configs.recommended,
// We want to enable this in the long run. For now there are a lot of errors that needs to be handled.
// eslintTs.configs.recommendedTypeChecked,
eslintTs.configs.recommended,
prettierConfig,
rootConfig,
tsxConfig,
disabledTypeCheckConfig,
commonConfig,
cursorlessEngineConfig,
cursorlessVscodeConfig,
cursorlessOrgConfig,
);
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"fix:syncpack": "pnpm syncpack fix-mismatches",
"init-vscode-sandbox": "pnpm --filter=@cursorless/cursorless-vscode init-launch-sandbox",
"lint:meta": "pnpm run meta-updater:base --test",
"lint:ts": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint packages --ext ts,tsx,mts",
"lint:ts": "eslint packages --ext ts,tsx,mts",
"lint": "pnpm run lint:meta && syncpack list-mismatches && pnpm run lint:ts",
"meta-updater:base": "pnpm --filter=@cursorless/meta-updater build && meta-updater",
"preinstall": "npx only-allow pnpm",
Expand All @@ -31,23 +31,23 @@
"watch:tsc": "tsc --build --watch"
},
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.31.0",
"@pnpm/meta-updater": "^2.0.6",
"@types/node": "^24.0.15",
"@typescript-eslint/eslint-plugin": "^8.38.0",
"@typescript-eslint/parser": "^8.38.0",
"cross-env": "^7.0.3",
"esbuild": "^0.25.8",
"eslint": "^9.31.0",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-mocha": "^10.5.0",
"eslint-plugin-unicorn": "^56.0.1",
"eslint-plugin-mocha": "^11.1.0",
"eslint-plugin-unicorn": "^60.0.0",
"eslint-plugin-unused-imports": "^4.1.4",
"prettier": "~3.3.3",
"prettier-plugin-tailwindcss": "^0.6.14",
"syncpack": "^13.0.4",
"typescript": "^5.8.3"
"typescript": "^5.8.3",
"typescript-eslint": "^8.38.0"
},
"pnpm": {
"patchedDependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/cheatsheet-local/src/webpack.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Generated using webpack-cli https://github.com/webpack/webpack-cli
/*eslint-env node*/

import {
cheatsheetBodyClasses,
Expand Down
11 changes: 0 additions & 11 deletions packages/common/.eslintrc.json

This file was deleted.

37 changes: 37 additions & 0 deletions packages/common/eslint.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import type { ConfigArray } from "typescript-eslint";

export const commonConfig: ConfigArray = [
{
files: ["packages/common/**/*.ts"],

ignores: ["**/*.test.ts"],

rules: {
"import/no-nodejs-modules": "error",
},
},

{
files: ["packages/common/src/types/command/**/*.ts"],

rules: {
"@typescript-eslint/no-restricted-imports": [
"error",
{
patterns: [
{
group: ["@cursorless/*", "../*"],
message: "API types shouldn't have any dependencies",
},
],
paths: [
{
name: "@*",
message: "API types shouldn't have any dependencies",
},
],
},
],
},
},
];
4 changes: 3 additions & 1 deletion packages/common/scripts/my-ts-node.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env node
// @ts-check
/*eslint-env node*/
/* global process, console */

// This script runs a TypeScript file using Node.js by first bundling it with
// esbuild.

import { spawn } from "cross-spawn";
import { build } from "esbuild";
import { existsSync, mkdirSync, rmdirSync } from "node:fs";
Expand Down
Loading
Loading