2023-08-22 19:40:11 +12:00
|
|
|
import unocss from '@unocss/eslint-plugin';
|
|
|
|
import common from 'eslint-config-neon/flat/common.js';
|
|
|
|
import edge from 'eslint-config-neon/flat/edge.js';
|
|
|
|
import next from 'eslint-config-neon/flat/next.js';
|
|
|
|
import node from 'eslint-config-neon/flat/node.js';
|
|
|
|
import prettier from 'eslint-config-neon/flat/prettier.js';
|
|
|
|
import react from 'eslint-config-neon/flat/react.js';
|
|
|
|
import typescript from 'eslint-config-neon/flat/typescript.js';
|
2023-08-24 16:43:23 +12:00
|
|
|
import merge from 'lodash.merge';
|
2023-08-28 06:24:03 +12:00
|
|
|
// import {join} from "node:path"
|
2023-08-22 19:40:11 +12:00
|
|
|
|
2023-08-24 16:43:23 +12:00
|
|
|
const commonFiles = '{js,mjs,cjs,ts,mts,cts,jsx,tsx}';
|
|
|
|
|
|
|
|
const commonRuleset = merge(...common, { files: [`**/*${commonFiles}`] });
|
|
|
|
|
|
|
|
const nodeRuleset = merge(...node, { files: [`**/*${commonFiles}`] });
|
|
|
|
|
|
|
|
const typeScriptRuleset = merge(...typescript, {
|
|
|
|
files: [`**/*${commonFiles}`],
|
|
|
|
languageOptions: {
|
|
|
|
parserOptions: {
|
2023-08-28 06:24:03 +12:00
|
|
|
warnOnUnsupportedTypeScriptVersion: false,
|
2023-08-24 16:43:23 +12:00
|
|
|
allowAutomaticSingleRunInference: true,
|
2023-08-25 09:08:29 +12:00
|
|
|
project: ['tsconfig.eslint.json', 'apps/*/tsconfig.eslint.json', 'packages/*/tsconfig.eslint.json'],
|
2023-08-22 19:40:11 +12:00
|
|
|
},
|
2023-08-24 16:43:23 +12:00
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
'@typescript-eslint/consistent-type-definitions': [2, 'interface'],
|
|
|
|
},
|
|
|
|
settings: {
|
|
|
|
'import/resolver': {
|
|
|
|
typescript: {
|
2023-08-25 09:08:29 +12:00
|
|
|
project: ['tsconfig.eslint.json', 'apps/*/tsconfig.eslint.json', 'packages/*/tsconfig.eslint.json'],
|
2023-08-22 19:40:11 +12:00
|
|
|
},
|
|
|
|
},
|
2023-08-24 16:43:23 +12:00
|
|
|
},
|
|
|
|
});
|
2023-08-22 19:40:11 +12:00
|
|
|
|
2023-08-24 16:43:23 +12:00
|
|
|
const reactRuleset = merge(...react, {
|
|
|
|
files: [`apps/**/*${commonFiles}`, `packages/ui/**/*${commonFiles}`],
|
|
|
|
plugins: { '@unocss': unocss },
|
|
|
|
rules: {
|
|
|
|
'@unocss/order': 2,
|
|
|
|
'@next/next/no-html-link-for-pages': 0,
|
|
|
|
'react/react-in-jsx-scope': 0,
|
|
|
|
'react/jsx-filename-extension': [1, { extensions: ['.tsx'] }],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const nextRuleset = merge(...next, { files: [`apps/**/*${commonFiles}`] });
|
|
|
|
|
|
|
|
const edgeRuleset = merge(...edge, { files: [`apps/**/*${commonFiles}`] });
|
|
|
|
|
|
|
|
const prettierRuleset = merge(...prettier, { files: [`**/*${commonFiles}`] });
|
2023-08-22 19:40:11 +12:00
|
|
|
|
|
|
|
/** @type {import('eslint').Linter.FlatConfig[]} */
|
|
|
|
export default [
|
|
|
|
{
|
2023-08-24 16:43:23 +12:00
|
|
|
ignores: [
|
|
|
|
'**/node_modules/',
|
|
|
|
'.git/',
|
|
|
|
'**/dist/',
|
|
|
|
'**/template/',
|
|
|
|
'**/coverage/',
|
|
|
|
'**/storybook-static/',
|
|
|
|
'**/.next/',
|
|
|
|
'packages/discord.js/',
|
|
|
|
],
|
2023-08-22 19:40:11 +12:00
|
|
|
},
|
2023-08-24 16:43:23 +12:00
|
|
|
commonRuleset,
|
|
|
|
nodeRuleset,
|
|
|
|
typeScriptRuleset,
|
2023-08-22 19:40:11 +12:00
|
|
|
{
|
2023-08-24 16:43:23 +12:00
|
|
|
files: ['**/*{ts,mts,cts,tsx}'],
|
|
|
|
rules: { 'jsdoc/no-undefined-types': 0 },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: [`packages/docgen/**/*${commonFiles}`],
|
|
|
|
rules: { 'import/extensions': 0 },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
files: [`packages/rest/**/*${commonFiles}`],
|
2023-08-22 19:40:11 +12:00
|
|
|
rules: {
|
|
|
|
'n/prefer-global/url': 0,
|
|
|
|
'n/prefer-global/url-search-params': 0,
|
|
|
|
'n/prefer-global/buffer': 0,
|
|
|
|
'n/prefer-global/process': 0,
|
|
|
|
'no-restricted-globals': 0,
|
|
|
|
'unicorn/prefer-node-protocol': 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
2023-08-24 16:43:23 +12:00
|
|
|
files: [`packages/voice/**/*${commonFiles}`],
|
2023-08-22 19:40:11 +12:00
|
|
|
rules: {
|
|
|
|
'import/extensions': 0,
|
|
|
|
'no-restricted-globals': 0,
|
|
|
|
},
|
|
|
|
},
|
2023-08-25 09:44:35 +12:00
|
|
|
reactRuleset,
|
2023-08-24 16:43:23 +12:00
|
|
|
nextRuleset,
|
|
|
|
edgeRuleset,
|
|
|
|
{
|
|
|
|
files: ['**/*{js,mjs,cjs,jsx}'],
|
|
|
|
rules: { 'tsdoc/syntax': 0 },
|
|
|
|
},
|
2023-08-22 19:40:11 +12:00
|
|
|
prettierRuleset,
|
|
|
|
];
|