mirror of
https://github.com/PretendoNetwork/miiverse-api.git
synced 2026-03-21 17:24:38 -05:00
chore: move to eslint common config and don't use npx for lint script
This commit is contained in:
parent
5998e511ea
commit
93ae63c8d6
|
|
@ -1,103 +1,11 @@
|
|||
/* eslint-disable import/no-unresolved -- We don't care about resolving imports in here */
|
||||
import eslintConfig from '@pretendonetwork/eslint-config';
|
||||
|
||||
import eslint from '@eslint/js';
|
||||
import eslintCommentPlugin from '@eslint-community/eslint-plugin-eslint-comments/configs';
|
||||
import stylisticPlugin from '@stylistic/eslint-plugin';
|
||||
import importPlugin from 'eslint-plugin-import';
|
||||
import tseslint from 'typescript-eslint';
|
||||
|
||||
const stylisticConfig = stylisticPlugin.configs.customize({
|
||||
indent: 'tab',
|
||||
quotes: 'single',
|
||||
semi: true,
|
||||
commaDangle: 'never',
|
||||
braceStyle: '1tbs'
|
||||
});
|
||||
|
||||
export default tseslint.config(
|
||||
export default [
|
||||
...eslintConfig,
|
||||
{
|
||||
// https://eslint.org/docs/rules/
|
||||
extends: [eslint.configs.recommended],
|
||||
rules: {
|
||||
'require-atomic-updates': 'off', // This rule is widely controversial and causes false positives
|
||||
'no-console': 'off',
|
||||
'prefer-const': 'error',
|
||||
'no-var': 'error',
|
||||
'no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^ignore' }
|
||||
],
|
||||
'one-var': ['error', 'never']
|
||||
}
|
||||
},
|
||||
{
|
||||
// https://typescript-eslint.io/rules/
|
||||
extends: [tseslint.configs.recommended],
|
||||
files: ['**/*.ts', '**/*.d.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
'error',
|
||||
{ argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^ignore' }
|
||||
],
|
||||
'@typescript-eslint/no-inferrable-types': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'error',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-empty-object-type': ['off'],
|
||||
'@typescript-eslint/no-import-type-side-effects': 'error',
|
||||
'@typescript-eslint/consistent-type-imports': ['error', {
|
||||
fixStyle: 'separate-type-imports'
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
// https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/
|
||||
extends: [eslintCommentPlugin.recommended],
|
||||
rules: {
|
||||
'@eslint-community/eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
|
||||
'@eslint-community/eslint-comments/require-description': 'error'
|
||||
}
|
||||
},
|
||||
{
|
||||
// https://eslint.style/rules
|
||||
extends: [stylisticConfig],
|
||||
rules: {
|
||||
'@stylistic/no-extra-semi': 'error',
|
||||
'@stylistic/yield-star-spacing': ['error', 'after'],
|
||||
'@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
|
||||
'@stylistic/curly-newline': ['error', {
|
||||
multiline: true,
|
||||
consistent: true
|
||||
}],
|
||||
'@stylistic/object-curly-newline': ['error', {
|
||||
multiline: true,
|
||||
consistent: true
|
||||
}]
|
||||
}
|
||||
},
|
||||
{
|
||||
// https://www.npmjs.com/package/eslint-plugin-import
|
||||
extends: [importPlugin.flatConfigs.recommended, importPlugin.flatConfigs.warnings],
|
||||
rules: {
|
||||
'import/order': ['warn', {
|
||||
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
|
||||
'newlines-between': 'never'
|
||||
}],
|
||||
'import/first': 'error',
|
||||
'import/consistent-type-specifier-style': ['error', 'prefer-top-level']
|
||||
}
|
||||
},
|
||||
{
|
||||
// https://www.npmjs.com/package/eslint-plugin-import - but specifically for TypeScript
|
||||
extends: [importPlugin.flatConfigs.typescript],
|
||||
files: ['**/*.ts', '**/*.d.ts'],
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
typescript: {
|
||||
alwaysTryTypes: true,
|
||||
project: './tsconfig.json'
|
||||
},
|
||||
node: true
|
||||
}
|
||||
}
|
||||
ignores: [
|
||||
'scripts/*',
|
||||
'dist/*'
|
||||
]
|
||||
}
|
||||
);
|
||||
];
|
||||
|
|
|
|||
22
package-lock.json
generated
22
package-lock.json
generated
|
|
@ -32,8 +32,7 @@
|
|||
"zod": "^3.21.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
||||
"@stylistic/eslint-plugin": "^2.13.0",
|
||||
"@pretendonetwork/eslint-config": "^0.0.1",
|
||||
"@types/bmp-js": "^0.1.2",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/fs-extra": "^11.0.1",
|
||||
|
|
@ -43,11 +42,8 @@
|
|||
"@types/node-rsa": "^1.1.1",
|
||||
"@types/pako": "^2.0.0",
|
||||
"@types/pngjs": "^6.0.1",
|
||||
"@typescript-eslint/parser": "^8.20.0",
|
||||
"axios": "^1.3.6",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-import-resolver-typescript": "^3.7.0",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"newman": "^6.0.0",
|
||||
"ora": "^5.4.1",
|
||||
"postman-collection": "^4.1.7",
|
||||
|
|
@ -55,7 +51,6 @@
|
|||
"ts-unused-exports": "^9.0.4",
|
||||
"tsc-alias": "^1.8.5",
|
||||
"typescript": "^5.0.4",
|
||||
"typescript-eslint": "^8.20.0",
|
||||
"xmlbuilder2": "^3.1.0"
|
||||
}
|
||||
},
|
||||
|
|
@ -1071,6 +1066,21 @@
|
|||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@pretendonetwork/eslint-config": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@pretendonetwork/eslint-config/-/eslint-config-0.0.1.tgz",
|
||||
"integrity": "sha512-eGFD1kL5xUiNLGIuSaBL0ArYHZ8D3CN8hPJtUJC19RNtkGTMfrC3sUEFguGt9HHKmO28D3S2ekYqAGUQ9Xn/PQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
||||
"@stylistic/eslint-plugin": "^2.12.1",
|
||||
"@typescript-eslint/parser": "^8.20.0",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint-import-resolver-typescript": "^3.7.0",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"typescript-eslint": "^8.19.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@pretendonetwork/grpc": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@pretendonetwork/grpc/-/grpc-1.0.6.tgz",
|
||||
|
|
|
|||
12
package.json
12
package.json
|
|
@ -4,7 +4,8 @@
|
|||
"description": "Miiverse API Server",
|
||||
"main": "./dist/server.js",
|
||||
"scripts": {
|
||||
"lint": "npx eslint .",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"build": "npm run lint && npm run clean && npx tsc && npx tsc-alias",
|
||||
"clean": "rimraf ./dist",
|
||||
"start": "node --enable-source-maps .",
|
||||
|
|
@ -50,8 +51,7 @@
|
|||
"zod": "^3.21.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
||||
"@stylistic/eslint-plugin": "^2.13.0",
|
||||
"@pretendonetwork/eslint-config": "^0.0.1",
|
||||
"@types/bmp-js": "^0.1.2",
|
||||
"@types/express": "^4.17.17",
|
||||
"@types/fs-extra": "^11.0.1",
|
||||
|
|
@ -61,11 +61,8 @@
|
|||
"@types/node-rsa": "^1.1.1",
|
||||
"@types/pako": "^2.0.0",
|
||||
"@types/pngjs": "^6.0.1",
|
||||
"@typescript-eslint/parser": "^8.20.0",
|
||||
"axios": "^1.3.6",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-import-resolver-typescript": "^3.7.0",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"newman": "^6.0.0",
|
||||
"ora": "^5.4.1",
|
||||
"postman-collection": "^4.1.7",
|
||||
|
|
@ -73,7 +70,6 @@
|
|||
"ts-unused-exports": "^9.0.4",
|
||||
"tsc-alias": "^1.8.5",
|
||||
"typescript": "^5.0.4",
|
||||
"typescript-eslint": "^8.20.0",
|
||||
"xmlbuilder2": "^3.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user