update devDependencies
[squeep-html-template-helper] / eslint.config.js
1 'use strict';
2 const globals = require('globals');
3 const js = require('@eslint/js');
4 const node = require('eslint-plugin-n');
5 const security = require('eslint-plugin-security');
6 const sonarjs = require('eslint-plugin-sonarjs');
7
8 const { FlatCompat } = require('@eslint/eslintrc');
9 const compat = new FlatCompat();
10
11 module.exports = [
12 js.configs.recommended,
13 ...compat.config(node.configs.recommended),
14 security.configs.recommended,
15 ...compat.config(sonarjs.configs.recommended),
16 {
17 files: [ '**/*.js' ],
18 plugins: {
19 node,
20 security,
21 sonarjs,
22 },
23 languageOptions: {
24 ecmaVersion: 2023,
25 sourceType: 'script',
26 },
27 rules: {
28 'array-element-newline': [
29 'error',
30 'consistent',
31 ],
32 'arrow-parens': [
33 'error',
34 'always',
35 ],
36 'arrow-spacing': [
37 'error',
38 {
39 'after': true,
40 'before': true,
41 },
42 ],
43 'block-scoped-var': 'error',
44 'block-spacing': 'error',
45 'brace-style': 'error',
46 'callback-return': 'error',
47 'camelcase': 'error',
48 'class-methods-use-this': 'error',
49 'comma-dangle': [
50 'error',
51 'always-multiline',
52 ],
53 'comma-spacing': [
54 'error',
55 {
56 'after': true,
57 'before': false,
58 },
59 ],
60 'comma-style': [
61 'error',
62 'last',
63 ],
64 'indent': [
65 'warn',
66 2,
67 {
68 'SwitchCase': 1,
69 },
70 ],
71 'sonarjs/cognitive-complexity': 'warn',
72 'keyword-spacing': 'error',
73 'linebreak-style': [
74 'error',
75 'unix',
76 ],
77 'no-unused-vars': [
78 'error', {
79 'varsIgnorePattern': '^_',
80 },
81 ],
82 'object-curly-spacing': [
83 'error',
84 'always',
85 ],
86 'prefer-const': 'error',
87 'quotes': [
88 'error',
89 'single',
90 ],
91 'semi': [
92 'error',
93 'always',
94 ],
95 'strict': 'error',
96 'vars-on-top': 'error',
97 },
98 },
99 {
100 files: ['test/**'],
101 languageOptions: {
102 globals: {
103 ...globals.mocha,
104 },
105 },
106 rules: {
107 "n/no-unpublished-require": "off",
108 },
109 },
110 ];