Skip to content

Commit

Permalink
added support for js in html script tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Mephisto5558 committed Oct 13, 2024
1 parent badd35a commit bae79fc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 4 additions & 0 deletions configs/html.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"indent": "+2",
"report-bad-indent": "warn"
}
18 changes: 11 additions & 7 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import typescriptPlugin from '@typescript-eslint/eslint-plugin';
import stylisticPlugin from '@stylistic/eslint-plugin';
import jsdocPlugin from 'eslint-plugin-jsdoc';
import sonarjsPlugin from 'eslint-plugin-sonarjs';
import regExPlugin from 'eslint-plugin-regexp';
import unicornPlugin from 'eslint-plugin-unicorn';
import regExPlugin from 'eslint-plugin-regexp';
import htmlPlugin from 'eslint-plugin-html';

export { plugins };

Expand All @@ -27,17 +28,18 @@ const
'@stylistic': stylisticPlugin,
jsdoc: jsdocPlugin,
sonarjs: sonarjsPlugin,
unicorn: unicornPlugin,
regexp: regExPlugin,
unicorn: unicornPlugin
html: htmlPlugin
},
rules = {
...importJsonC('configs/eslint.jsonc'),
...importJsonC('configs/@typescript-eslint.jsonc'),
...importJsonC('configs/@stylistic.jsonc'),
...importJsonC('configs/jsdoc.jsonc'),
...importJsonC('configs/sonarjs.jsonc'),
...importJsonC('configs/regexp.jsonc'),
...importJsonC('configs/unicorn.jsonc')
...importJsonC('configs/unicorn.jsonc'),
...importJsonC('configs/regexp.jsonc')
};


Expand All @@ -51,10 +53,9 @@ export default [
languageOptions: {
parser,
parserOptions: {
projectService: {
allowDefaultProject: ['./*.js', './*.html']
},
project: true,
tsconfigRootDir: '.',
extraFileExtensions: ['html'],
warnOnUnsupportedTypeScriptVersion: true
},
ecmaVersion: 'latest',
Expand All @@ -68,6 +69,9 @@ export default [
linterOptions: {
reportUnusedDisableDirectives: true
},
settings: {
...importJsonC('configs/html.jsonc')
},
plugins, rules
},
{
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@typescript-eslint/eslint-plugin": ">=8.8.1",
"@typescript-eslint/parser": "^8.8.1",
"eslint": "^9.12.0",
"eslint-plugin-html": ">=8.1.2",
"eslint-plugin-jsdoc": ">=50.3.2",
"eslint-plugin-regexp": ">=2.6.0",
"eslint-plugin-sonarjs": ">=1.0.4",
Expand Down

0 comments on commit bae79fc

Please sign in to comment.