Skip to content

Commit

Permalink
chore: migrate eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
ota-meshi committed Nov 30, 2024
1 parent 1bf4a33 commit 8b3c6ae
Show file tree
Hide file tree
Showing 21 changed files with 238 additions and 241 deletions.
39 changes: 18 additions & 21 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/javascript-node
{
"name": "Node.js",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 16, 14, 12.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local arm64/Apple Silicon.
"args": { "VARIANT": "16-bullseye" }
},
"name": "Node.js",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 16, 14, 12.
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local arm64/Apple Silicon.
"args": { "VARIANT": "16-bullseye" }
},

// Set *default* container specific settings.json values on container create.
"settings": {},
// Set *default* container specific settings.json values on container create.
"settings": {},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"dbaeumer.vscode-eslint",
"svelte.svelte-vscode"
],
// Add the IDs of extensions you want installed when the container is created.
"extensions": ["dbaeumer.vscode-eslint", "svelte.svelte-vscode"],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pnpm install",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pnpm install",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node"
}
18 changes: 0 additions & 18 deletions .eslintignore

This file was deleted.

16 changes: 0 additions & 16 deletions .eslintrc-for-playground.js

This file was deleted.

88 changes: 0 additions & 88 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"vetur.validation.template": false
"eslint.enable": true
}
2 changes: 1 addition & 1 deletion benchmark/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable-next-line eslint-comments/disable-enable-pair -- ignore
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair -- ignore
/* eslint-disable no-console -- ignore */
import * as Benchmark from "benchmark";
import fs from "fs";
Expand Down
167 changes: 167 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
import * as myPlugin from "@ota-meshi/eslint-plugin";
import globals from "globals";

export default [
{
ignores: [
".nyc_output",
"coverage",
"lib",
"node_modules",
"tests/fixtures/**/*.json",
"tests/fixtures/**/*.svelte",
"tests/fixtures/**/*.js",
"tests/fixtures/**/*.ts",
"explorer/dist",
"explorer/node_modules",
"explorer-v2/build",
"explorer-v2/build",
"explorer-v2/build-system/shim/svelte-eslint-parser.*",
"explorer-v2/build-system/shim/eslint-scope.*",
"explorer-v2/build-system/shim/eslint.*",
"explorer-v2/build-system/shim/svelte/*",
"!.vscode",
"!.github",
"explorer-v2/.svelte-kit",
".changeset/pre.json",
],
},
...myPlugin.config({
node: true,
ts: true,
json: true,
packageJson: true,
yaml: true,
prettier: true,
}),
{
languageOptions: {
sourceType: "module",
},

rules: {
"no-lonely-if": "off",
"no-shadow": "off",
"@typescript-eslint/no-shadow": "off",
"no-warning-comments": "warn",
"jsdoc/require-jsdoc": "off",
complexity: "off",

"prettier/prettier": [
"error",
{},
{
usePrettierrc: true,
},
],
},
},
{
files: ["**/*.ts"],

languageOptions: {
parserOptions: {
project: "./tsconfig.json",
},
},

rules: {
"@typescript-eslint/naming-convention": [
"error",
{
selector: "default",
format: ["camelCase"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: "variable",
format: ["camelCase", "UPPER_CASE"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: "typeLike",
format: ["PascalCase"],
},
{
selector: "property",
format: null,
},
{
selector: "method",
format: null,
},
{
selector: "import",
format: ["camelCase", "PascalCase", "UPPER_CASE"],
},
],

"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-explicit-any": "off",
"no-implicit-globals": "off",

"no-void": [
"error",
{
allowAsStatement: true,
},
],
},
},
{
files: ["scripts/**/*.ts", "tests/**/*.ts"],

rules: {
"no-console": "off",
"jsdoc/require-jsdoc": "off",
},
},

...myPlugin
.config({
prettier: true,
svelte: true,
})
.map(async (config) => ({
...(await config),
files: ["explorer-v2/**/*.svelte"],
})),
{
files: ["explorer-v2/**/*.{svelte,js}"],
languageOptions: {
globals: {
...globals.browser,
},
},
rules: {
"eslint-comments/no-unused-disable": "off",
"n/no-missing-import": "off",
"n/no-unpublished-require": "off",
"n/no-unpublished-import": "off",
"n/no-unsupported-features/es-syntax": "off",
"n/no-unsupported-features/node-builtins": "off",
"require-jsdoc": "off",
"n/file-extension-in-import": "off",

"prettier/prettier": [
"error",
{},
{
usePrettierrc: true,
},
],

"no-shadow": "off",
camelcase: "off",
},
},
{
files: ["**/*.d.ts"],
rules: {
"spaced-comment": "off",
},
},
];
Loading

0 comments on commit 8b3c6ae

Please sign in to comment.