Skip to content

Commit b1c31d4

Browse files
committed
chore(eslint): switch to es import & update lint script command
+ add a lint:fix script Ref https://github.com/brunob/leaflet.fullscreen/blob/master/eslint.config.mjs
1 parent 2a53d5a commit b1c31d4

File tree

3 files changed

+54
-54
lines changed

3 files changed

+54
-54
lines changed

eslint.config.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import globals from 'globals';
2+
import eslintPluginEslint from '@eslint/js';
3+
import eslintPluginStylistic from '@stylistic/eslint-plugin-js';
4+
import eslintPluginHtml from 'eslint-plugin-html';
5+
6+
const config = [
7+
{
8+
files: ['**/*.js'],
9+
languageOptions: {
10+
globals: {
11+
...globals.browser,
12+
...globals.node,
13+
define: 'readonly',
14+
L: 'writable'
15+
}
16+
},
17+
plugins: {
18+
...eslintPluginStylistic.configs['all-flat'].plugins
19+
},
20+
rules: {
21+
...eslintPluginEslint.configs['recommended'].rules,
22+
...eslintPluginStylistic.configs['all-flat'].rules,
23+
'@stylistic/js/brace-style': ['error', '1tbs'],
24+
'@stylistic/js/comma-dangle': ['error', 'only-multiline'],
25+
'@stylistic/js/dot-location': ['error', 'property'],
26+
'@stylistic/js/function-call-argument-newline': ['error', 'consistent'],
27+
'@stylistic/js/indent': ['error', 'tab'],
28+
'@stylistic/js/multiline-comment-style': 'off',
29+
'@stylistic/js/no-tabs': 'off',
30+
'@stylistic/js/object-curly-spacing': ['error', 'always'],
31+
'@stylistic/js/padded-blocks': 'off',
32+
'@stylistic/js/quotes': ['error', 'single'],
33+
'@stylistic/js/quote-props': ['error', 'consistent-as-needed'],
34+
'@stylistic/js/semi': ['error', 'always'],
35+
'@stylistic/js/space-before-function-paren': ['error', 'never'],
36+
'@stylistic/js/array-element-newline': ["error", "consistent"],
37+
'no-lonely-if': 'error',
38+
'no-unused-expressions': ['error', { allowTernary: true }]
39+
}
40+
},
41+
{
42+
files: ['**/*.html'],
43+
plugins: {
44+
eslintPluginHtml,
45+
},
46+
settings: {
47+
'html/report-bad-indent': 2,
48+
},
49+
}
50+
];
51+
52+
export default config;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"scripts": {
1111
"test": "npm run lint",
1212
"testsuite": "mocha-chrome tests/index.html",
13-
"lint": "eslint --config eslint.config.js leaflet-providers.js index.html preview/*.js preview/*.html tests/*",
13+
"lint": "eslint leaflet-providers.js index.html preview/*.js preview/*.html tests/*",
14+
"lint:fix": "eslint --fix leaflet-providers.js index.html preview/*.js preview/*.html tests/*",
1415
"min": "uglifyjs leaflet-providers.js -mc -o leaflet-providers.min.js",
1516
"preversion": "npm run min",
1617
"postversion": "git push && git push --tags && npm publish"

0 commit comments

Comments
 (0)