Fix streaming eslint configuration (#28055)

This commit is contained in:
Emelia Smith 2023-11-28 15:09:21 +01:00 committed by GitHub
parent a80530d1df
commit 4949b6da58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 78 additions and 13 deletions

View file

@ -1,4 +1,7 @@
module.exports = { // @ts-check
const { defineConfig } = require('eslint-define-config');
module.exports = defineConfig({
root: true, root: true,
extends: [ extends: [
@ -193,6 +196,7 @@ module.exports = {
'error', 'error',
{ {
devDependencies: [ devDependencies: [
'.eslintrc.js',
'config/webpack/**', 'config/webpack/**',
'app/javascript/mastodon/performance.js', 'app/javascript/mastodon/performance.js',
'app/javascript/mastodon/test_setup.js', 'app/javascript/mastodon/test_setup.js',
@ -299,6 +303,7 @@ module.exports = {
overrides: [ overrides: [
{ {
files: [ files: [
'.eslintrc.js',
'*.config.js', '*.config.js',
'.*rc.js', '.*rc.js',
'ide-helper.js', 'ide-helper.js',
@ -372,14 +377,6 @@ module.exports = {
env: { env: {
jest: true, jest: true,
}, },
}, }
{
files: [
'streaming/**/*',
],
rules: {
'import/no-commonjs': 'off',
},
},
], ],
}; });

View file

@ -184,6 +184,7 @@
"babel-jest": "^29.5.0", "babel-jest": "^29.5.0",
"eslint": "^8.41.0", "eslint": "^8.41.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"eslint-define-config": "^2.0.0",
"eslint-import-resolver-typescript": "^3.5.5", "eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-formatjs": "^4.10.1", "eslint-plugin-formatjs": "^4.10.1",
"eslint-plugin-import": "~2.29.0", "eslint-plugin-import": "~2.29.0",

32
streaming/.eslintrc.js Normal file
View file

@ -0,0 +1,32 @@
// @ts-check
const { defineConfig } = require('eslint-define-config');
module.exports = defineConfig({
extends: ['../.eslintrc.js'],
env: {
browser: false,
},
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
ecmaFeatures: {
jsx: false,
},
ecmaVersion: 2021,
},
rules: {
'import/no-commonjs': 'off',
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: [
'streaming/.eslintrc.js',
],
optionalDependencies: false,
peerDependencies: false,
includeTypes: true,
packageDir: __dirname,
},
],
},
});

View file

@ -12,7 +12,8 @@
"url": "https://github.com/mastodon/mastodon.git" "url": "https://github.com/mastodon/mastodon.git"
}, },
"scripts": { "scripts": {
"start": "node ./index.js" "start": "node ./index.js",
"check:types": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
@ -30,7 +31,10 @@
"@types/express": "^4.17.17", "@types/express": "^4.17.17",
"@types/npmlog": "^7.0.0", "@types/npmlog": "^7.0.0",
"@types/pg": "^8.6.6", "@types/pg": "^8.6.6",
"@types/uuid": "^9.0.0" "@types/uuid": "^9.0.0",
"@types/ws": "^8.5.9",
"eslint-define-config": "^2.0.0",
"typescript": "^5.0.4"
}, },
"optionalDependencies": { "optionalDependencies": {
"bufferutil": "^4.0.7", "bufferutil": "^4.0.7",

11
streaming/tsconfig.json Normal file
View file

@ -0,0 +1,11 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"target": "esnext",
"module": "CommonJS",
"moduleResolution": "node",
"noUnusedParameters": false,
"paths": {}
},
"include": ["./*.js", "./.eslintrc.js"]
}

View file

@ -2362,6 +2362,7 @@ __metadata:
escape-html: "npm:^1.0.3" escape-html: "npm:^1.0.3"
eslint: "npm:^8.41.0" eslint: "npm:^8.41.0"
eslint-config-prettier: "npm:^9.0.0" eslint-config-prettier: "npm:^9.0.0"
eslint-define-config: "npm:^2.0.0"
eslint-import-resolver-typescript: "npm:^3.5.5" eslint-import-resolver-typescript: "npm:^3.5.5"
eslint-plugin-formatjs: "npm:^4.10.1" eslint-plugin-formatjs: "npm:^4.10.1"
eslint-plugin-import: "npm:~2.29.0" eslint-plugin-import: "npm:~2.29.0"
@ -2469,8 +2470,10 @@ __metadata:
"@types/npmlog": "npm:^7.0.0" "@types/npmlog": "npm:^7.0.0"
"@types/pg": "npm:^8.6.6" "@types/pg": "npm:^8.6.6"
"@types/uuid": "npm:^9.0.0" "@types/uuid": "npm:^9.0.0"
"@types/ws": "npm:^8.5.9"
bufferutil: "npm:^4.0.7" bufferutil: "npm:^4.0.7"
dotenv: "npm:^16.0.3" dotenv: "npm:^16.0.3"
eslint-define-config: "npm:^2.0.0"
express: "npm:^4.18.2" express: "npm:^4.18.2"
ioredis: "npm:^5.3.2" ioredis: "npm:^5.3.2"
jsdom: "npm:^23.0.0" jsdom: "npm:^23.0.0"
@ -2478,6 +2481,7 @@ __metadata:
pg: "npm:^8.5.0" pg: "npm:^8.5.0"
pg-connection-string: "npm:^2.6.0" pg-connection-string: "npm:^2.6.0"
prom-client: "npm:^15.0.0" prom-client: "npm:^15.0.0"
typescript: "npm:^5.0.4"
utf-8-validate: "npm:^6.0.3" utf-8-validate: "npm:^6.0.3"
uuid: "npm:^9.0.0" uuid: "npm:^9.0.0"
ws: "npm:^8.12.1" ws: "npm:^8.12.1"
@ -3644,6 +3648,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/ws@npm:^8.5.9":
version: 8.5.9
resolution: "@types/ws@npm:8.5.9"
dependencies:
"@types/node": "npm:*"
checksum: 678bdd6461c4653f2975c537fb673cb1918c331558e2d2422b69761c9ced67200bb07c664e2593f3864077a891cb7c13ef2a40d303b4aacb06173d095d8aa3ce
languageName: node
linkType: hard
"@types/yargs-parser@npm:*": "@types/yargs-parser@npm:*":
version: 21.0.2 version: 21.0.2
resolution: "@types/yargs-parser@npm:21.0.2" resolution: "@types/yargs-parser@npm:21.0.2"
@ -7302,6 +7315,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"eslint-define-config@npm:^2.0.0":
version: 2.0.0
resolution: "eslint-define-config@npm:2.0.0"
checksum: 617c3143bc1ed8df0b20ae632d428d5f241dbb04483631e1410c58fe65ba3e503cf94631c5973115482b58ba464d052422a718c0f4d49182f8d13ffbb36bf1d6
languageName: node
linkType: hard
"eslint-import-resolver-node@npm:^0.3.9": "eslint-import-resolver-node@npm:^0.3.9":
version: 0.3.9 version: 0.3.9
resolution: "eslint-import-resolver-node@npm:0.3.9" resolution: "eslint-import-resolver-node@npm:0.3.9"