Skip to content

Commit

Permalink
chore(eslint): upgrade eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
jbms committed Dec 12, 2024
1 parent 544c9e8 commit dfda2f0
Show file tree
Hide file tree
Showing 18 changed files with 2,951 additions and 3,321 deletions.
16 changes: 0 additions & 16 deletions .eslintignore

This file was deleted.

68 changes: 0 additions & 68 deletions .eslintrc.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .ncurc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
reject:
# API break
- "gl-matrix"
- "@types/gl-matrix"
# Newer versions don't support eslint
- "fork-ts-checker-webpack-plugin"
# API break
- "codemirror"
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ prune examples
exclude .clang-format
exclude .editorconfig
exclude .eslintignore
exclude .eslintrc
exclude .style.yapf
exclude cors_webserver.py
exclude gulpfile.js
Expand All @@ -36,7 +35,8 @@ exclude MANIFEST.in
exclude *.ts
exclude .prettierrc.yml
exclude .prettierignore
exclude .eslintrc.yml
exclude eslint.config.js
exclude .ncurc.yml
exclude index.html
exclude webpack.config.js
exclude firebase.json
Expand Down
2 changes: 1 addition & 1 deletion build_tools/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { pathToFileURL } from "node:url";
import path from "path";
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
import type { Configuration } from "webpack";
import webpackCli from "webpack-cli/lib/bootstrap.js"; // eslint-disable-line import/default
import webpackCli from "webpack-cli/lib/bootstrap.js";
import * as webpackMerge from "webpack-merge";
import yargs from "yargs";
import { normalizeConfigurationWithDefine } from "./webpack/configuration_with_define.js";
Expand Down
124 changes: 124 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
// @ts-check

import eslint from "@eslint/js";
// @ts-expect-error missing .d.ts file
import importPlugin from "eslint-plugin-import";
import tseslint from "typescript-eslint";

export default tseslint.config(
{
ignores: [
"**/node_modules",
"**/dist",
"**/python",
"templates/neuroglancer/sliceview",
"src/third_party/jpgjs/jpg.js",
"**/templates",
"**/build",
"**/.tox",
"**/.nox",
"lib",
"**/python",
"**/config",
"**/typings",
"src/mesh/draco/stub.js",
"**/tsconfig.tsbuildinfo",
"examples",
],
},
eslint.configs.recommended,
tseslint.configs.recommended,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
{
settings: {
"import/resolver": {
typescript: {},
node: {},
},
},
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "off",

"prefer-const": [
"error",
{
destructuring: "all",
},
],

"no-constant-condition": "off",

"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],

"@typescript-eslint/no-unsafe-function-type": "off",

"no-unsafe-finally": "off",
"require-yield": "off",
"no-inner-declarations": "off",
"import/no-named-as-default": "off",
"import/no-named-as-default-member": "off",
"import/no-cycle": [
"error",
{
ignoreExternal: true,
disableScc: true,
},
],
"@typescript-eslint/consistent-type-imports": "error",
"import/no-unresolved": "error",
"import/no-extraneous-dependencies": "error",
"import/first": "error",

"import/order": [
"error",
{
groups: ["builtin", "external", "internal"],

alphabetize: {
order: "asc",
orderImportKind: "asc",
},
},
],

// Neuroglancer uses `varname;` to suppress unused parameter warnings.
"@typescript-eslint/no-unused-expressions": "off",
},
},
{
files: ["src/**/*"],

rules: {
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["./", "../"],
message: "Relative imports are not allowed.",
},
],
},
],
},
},
{
files: ["build_tools/**/*.cjs"],
languageOptions: {
sourceType: "commonjs",
},
},
);
Loading

0 comments on commit dfda2f0

Please sign in to comment.