Skip to content

Conversation

@thomasjammet
Copy link
Collaborator

💼 Other

  • (eslint) Move .eslintrc.json to eslint.config.js after eslint upgrade
  • Update and make consitent version of node.js in github workflows

🛡️ Security

  • Fix glob dependency vulnerability

Comment on lines +1 to +77
import js from '@eslint/js';
import globals from 'globals';

import tsParser from '@typescript-eslint/parser';
import tsPlugin from '@typescript-eslint/eslint-plugin';

import htmlParser from '@html-eslint/parser';
import htmlPlugin from '@html-eslint/eslint-plugin';

import headersPlugin from 'eslint-plugin-headers';

export default [
// Replaces .eslintignore
{
ignores: ['dist/**', 'docs/**', 'eslint.config.js']
},

// Equivalent of "eslint:recommended"
js.configs.recommended,

// Base config for JS/TS files
{
files: ['**/*.{js,cjs,mjs,ts,tsx}'],
languageOptions: {
parser: tsParser,
parserOptions: {
sourceType: 'module',
ecmaVersion: 11,
allowImportExportEverywhere: true
},
globals: {
...globals.browser,
...globals.node,
...globals.es6,
Symbol: 'readonly'
}
},
plugins: {
'@typescript-eslint': tsPlugin,
headers: headersPlugin
},
rules: {
'no-warning-comments': ['error', { terms: ['todo'], location: 'start' }],
'no-console': 0,
curly: ['error'],
'no-empty': [2, { allowEmptyCatch: true }],
'no-unused-vars': 'off',
'no-undef': 'off',
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
'no-useless-escape': 0,
eqeqeq: ['error', 'smart'],
'headers/header-format': [
'error',
{
source: 'file',
path: '.eslint-header'
}
]
}
},

// HTML override
{
files: ['**/*.html'],
languageOptions: {
parser: htmlParser
},
plugins: {
'@html-eslint': htmlPlugin,
headers: headersPlugin
},
rules: {
'headers/header-format': 'off',
'@html-eslint/indent': ['error', 4]
}
}
];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When i did this few months ago for video.js. this was the closest rules to keep everything unchanged https://github.com/JoeTurki/videojs-plugins/blob/refactor/plugins/eslint.config.ts

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When i did this few months ago for video.js. this was the closest rules to keep everything unchanged https://github.com/JoeTurki/videojs-plugins/blob/refactor/plugins/eslint.config.ts

Thanks, what I tried is to keep it simple, only changes I had is :

  • add 'no-undef': 'off' because it otherwise now it complains about TS globals
  • I remove ban-types which doesn't exist anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants