-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Dev: Migrate to ESLint 9, flat config #32471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
93eedb1
d1d8d20
0a951b1
b5fed08
14188cd
7b79d99
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| import js from '@eslint/js'; | ||
| import globals from 'globals'; | ||
| import mdcs from 'eslint-config-mdcs'; | ||
| import compat from 'eslint-plugin-compat'; | ||
| import html from 'eslint-plugin-html'; | ||
| import importPlugin from 'eslint-plugin-import'; | ||
| import jsdoc from 'eslint-plugin-jsdoc'; | ||
|
|
||
| export default [ | ||
| // files to ignore | ||
| { | ||
| name: 'files to ignore', | ||
| ignores: [ | ||
| '**/node_modules/**', | ||
| '**/build/**', | ||
| '**/libs/**', | ||
| '**/ifc/**', | ||
| '**/prettify.js', | ||
| '**/prettify/**', | ||
| '**/3rdparty/**', | ||
| '**/shapefile.js', | ||
| '**/vendor/**', | ||
| '**/fuse/**' | ||
| ] | ||
| }, | ||
|
|
||
| // recommended | ||
| js.configs.recommended, | ||
| // jsdoc.configs['flat/recommended'], | ||
|
|
||
| // base rules | ||
| { | ||
| name: 'base rules', | ||
| files: [ '**/*.js', '**/*.html' ], | ||
| plugins: { | ||
| html, | ||
| import: importPlugin, | ||
| compat, | ||
| jsdoc | ||
| }, | ||
| languageOptions: { | ||
| ecmaVersion: 2018, | ||
| sourceType: 'module', | ||
| globals: { | ||
| ...globals.browser, | ||
| ...globals.node, | ||
| ...globals.es2017, | ||
| __THREE_DEVTOOLS__: 'readonly', | ||
| potpack: 'readonly', | ||
| fflate: 'readonly', | ||
| Stats: 'readonly', | ||
| XRWebGLBinding: 'readonly', | ||
| XRWebGLLayer: 'readonly', | ||
| GPUShaderStage: 'readonly', | ||
| GPUBufferUsage: 'readonly', | ||
| GPUTextureUsage: 'readonly', | ||
| GPUTexture: 'readonly', | ||
| GPUMapMode: 'readonly', | ||
| QUnit: 'readonly', | ||
| Ammo: 'readonly', | ||
| XRRigidTransform: 'readonly', | ||
| XRMediaBinding: 'readonly', | ||
| CodeMirror: 'readonly', | ||
| esprima: 'readonly', | ||
| jsonlint: 'readonly', | ||
| VideoFrame: 'readonly', | ||
| VideoDecoder: 'readonly', | ||
| Float16Array: 'readonly', | ||
| BigInt: 'readonly', | ||
| BigUint64Array: 'readonly' | ||
| }, | ||
| }, | ||
| settings: { | ||
| polyfills: [ | ||
| 'WebGL2RenderingContext' | ||
| ], | ||
| jsdoc: { | ||
| preferredTypes: { | ||
| Any: 'any', | ||
| Boolean: 'boolean', | ||
| Number: 'number', | ||
| object: 'Object', | ||
| String: 'string' | ||
| }, | ||
| tagNamePreference: { | ||
| returns: 'return', | ||
| extends: 'augments' | ||
| }, | ||
| }, | ||
| }, | ||
| rules: { | ||
| ...mdcs.rules, | ||
| ...compat.configs.recommended.rules, | ||
| 'no-throw-literal': 'error', | ||
| 'quotes': [ 'error', 'single' ], | ||
| 'prefer-const': [ 'error', { | ||
| destructuring: 'any', | ||
| ignoreReadBeforeAssign: false | ||
| } ], | ||
| 'no-irregular-whitespace': 'error', | ||
| 'no-duplicate-imports': 'error', | ||
| 'prefer-spread': 'error', | ||
|
|
||
| 'no-useless-escape': 'off', | ||
| 'no-case-declarations': 'off', | ||
| 'no-cond-assign': 'off', | ||
| 'getter-return': 'off', | ||
| 'no-async-promise-executor': 'off', | ||
| 'no-empty': 'off', | ||
|
Comment on lines
+104
to
+109
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I turned these off because they seemed to be new rules and were causing lint errors / warnings. It may be worth considering adjusting the codebase and turning these on. |
||
|
|
||
| // 'jsdoc/check-types': 'error', | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When this is enabled there are some errors in the JSDoc comments that are caught. I'll leave it to another contribution to re-enable and fix these. It may be worth enabling the JSDoc "recommended" settings above to see if there are any rules worth keeping from there, too. |
||
| 'jsdoc/require-returns': 'off', | ||
| 'jsdoc/require-returns-type': 'error', | ||
| 'jsdoc/require-param-description': 'off', | ||
| 'jsdoc/require-returns-description': 'off', | ||
| 'jsdoc/require-param-type': 'error' | ||
| } | ||
| } | ||
| ]; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines have been newly added