bump package version to 2.1.0
[squeep-api-dingus] / 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 'capitalized-comments': 'warn',
49 'class-methods-use-this': 'error',
50 'comma-dangle': [
51 'error',
52 'always-multiline',
53 ],
54 'comma-spacing': [
55 'error',
56 {
57 'after': true,
58 'before': false,
59 },
60 ],
61 'comma-style': [
62 'error',
63 'last',
64 ],
65 'indent': [
66 'warn',
67 2,
68 {
69 'SwitchCase': 1,
70 },
71 ],
72 'sonarjs/cognitive-complexity': 'warn',
73 'keyword-spacing': 'error',
74 'linebreak-style': [
75 'error',
76 'unix',
77 ],
78 'no-unused-vars': [
79 'error', {
80 'varsIgnorePattern': '^_',
81 },
82 ],
83 'object-curly-spacing': [
84 'error',
85 'always',
86 ],
87 'prefer-const': 'error',
88 'quotes': [
89 'error',
90 'single',
91 ],
92 'semi': [
93 'error',
94 'always',
95 ],
96 'strict': 'error',
97 'vars-on-top': 'error',
98 },
99 },
100 {
101 files: ['test/**'],
102 languageOptions: {
103 globals: {
104 ...globals.mocha,
105 },
106 },
107 rules: {
108 "n/no-unpublished-require": "off",
109 },
110 },
111 ];