Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 0 additions & 118 deletions .eslintrc.js

This file was deleted.

2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ updates:
schedule:
interval: 'monthly'
ignore:
# Needs more work.
- dependency-name: 'eslint*'
- dependency-name: '@elastic/elasticsearch'
# Needs Node >= 20.15, update when we get there.
- dependency-name: '@types/node'
Expand Down
163 changes: 163 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
const eslint = require('@eslint/js');
const eslintConfigPrettier = require('eslint-config-prettier');
const eslintPluginImport = require('eslint-plugin-import');
const eslintPluginJest = require('eslint-plugin-jest');
const eslintPluginPrettier = require('eslint-plugin-prettier');
const globals = require('globals');
const tseslint = require('typescript-eslint');

const sharedRules = {
'eol-last': 'error',
'import/order': [
'warn',
{
groups: [
['builtin', 'external'],
['internal', 'sibling', 'parent', 'index'],
],
pathGroups: [
{
pattern: '@weco/**',
group: 'external',
position: 'after',
},
],
pathGroupsExcludedImportTypes: ['builtin', 'object'],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
},
],
'no-mixed-operators': 'warn',
'no-multi-spaces': 'warn',
'no-multi-str': 'off',
'no-restricted-imports': [
'error',
{ patterns: ['../*'] }, // Should only import relatively from same directory
],
'no-restricted-syntax': [
'error',
"JSXElement.children > [expression.callee.property.name='stringify']",
],
'no-return-assign': 'off',
'prettier/prettier': 'error',
'sort-imports': [
'error',
{
ignoreCase: true,
ignoreDeclarationSort: true,
},
],
};

module.exports = [
// Global ignores
{
ignores: [
'**/node_modules/',
'**/libs/',
'**/lib/',
'**/_next/',
'**/dist/',
'**/.terraform/',
],
},
// Global linter options
{
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
},
// Base config for JS files
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parser: require('@babel/eslint-parser'),
parserOptions: {
ecmaFeatures: {
jsx: true,
},
requireConfigFile: false,
},
globals: {
...globals.node,
...globals.jest,
},
},
plugins: {
import: eslintPluginImport,
jest: eslintPluginJest,
prettier: eslintPluginPrettier,
},
rules: {
...eslint.configs.recommended.rules,
...sharedRules,
},
},
// TypeScript config
...tseslint.configs.recommended.map(config => ({
...config,
files: ['**/*.ts'],
})),
{
files: ['**/*.ts'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.node,
...globals.jest,
},
},
plugins: {
'@typescript-eslint': tseslint.plugin,
import: eslintPluginImport,
jest: eslintPluginJest,
prettier: eslintPluginPrettier,
},
rules: {
...sharedRules,
'no-use-before-define': 'off',
'@typescript-eslint/array-type': ['error'],
'@typescript-eslint/no-use-before-define': [
'error',
{ functions: false },
],
'@typescript-eslint/no-unused-vars': [
'error',
{ ignoreRestSiblings: true },
],
'jest/no-standalone-expect': [
'error',
{ additionalTestBlockFunctions: ['each.test'] },
],
},
},
// Jest test files
{
files: ['**/*test.ts'],
plugins: {
jest: eslintPluginJest,
},
rules: {
...eslintPluginJest.configs.recommended.rules,
},
},
// Webhook directory - disable restricted imports
{
files: ['webhook/**'],
rules: {
'no-restricted-imports': 'off',
},
},
// Prettier config (should be last)
eslintConfigPrettier,
];
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ async function prepareAssetsForDownload() {
url: urlObj.toString(),
filename,
};
} catch (e) {
} catch {
// If URL parsing fails for any reason, fall back to the original URL
return {
id: asset.id,
Expand Down
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,21 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.28.5",
"@eslint/js": "^9.39.2",
"@tsconfig/node20": "20.1.8",
"@typescript-eslint/eslint-plugin": "^8.51.0",
"@typescript-eslint/parser": "^8.51.0",
"husky": "^9.1.7",
"eslint": "^8.46.0",
"eslint-plugin-import": "^2.30.0",
"eslint": "^9.39.2",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.0.0",
"eslint-plugin-jest-playwright": "^0.9.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-standard": "^5.0.0",
"globals": "^15.0.0",
"husky": "^9.1.7",
"lint-staged": "^13.1.2",
"prettier": "^3.7.3"
"prettier": "^3.7.3",
"typescript-eslint": "^8.48.0"
},
"lint-staged": {
"*.{js,ts}": [
Expand Down
Loading