Skip to content

Commit

Permalink
add jsconfig. convert .eslintrc from JSON to JS
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Fernández Serrata committed Mar 6, 2024
1 parent 01f2008 commit 8d970fb
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 85 deletions.
101 changes: 101 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
'use strict'
//eslint-disable-next-line no-implicit-globals
const m = 'Use arrow fn instead.'

Check warning

Code scanning / ESLint

Disallow unused variables Warning

'm' is assigned a value but never used. Allowed unused vars must match /^_$/u.

Check failure

Code scanning / ESLint

Disallow declarations in the global scope Error

Unexpected 'const' declaration in the global scope, wrap in a block or in an IIFE.

//eslint-disable-next-line no-undef
module.exports = {

Check failure

Code scanning / ESLint

Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error

'module' is not defined.
env: {
browser: true,
es2021: true
},
extends: 'eslint:recommended',
parserOptions: {
ecmaVersion: 'latest'
},
rules: {
'no-magic-numbers': [
'warn',
{
ignore: [
-1,
0,
1,
2
],
ignoreArrayIndexes: true,
ignoreDefaultValues: true,
enforceConst: true
}
],
'no-unused-vars': [
'warn',
{
varsIgnorePattern: '^_$',
argsIgnorePattern: '^_$'
}
],
'no-param-reassign': 'error',
'no-implicit-globals': [
'error',
{
lexicalBindings: true
}
],/*
'no-restricted-syntax': [
'error',
{
selector: 'FunctionDeclaration',
message: m
},
{
selector: 'FunctionExpression',
message: m
}
],*/
'no-empty-function': 'error',
'no-loop-func': 'error',
'no-lone-blocks': 'error',
'no-constant-binary-expression': 'error',
'no-self-compare': 'error',
'no-unmodified-loop-condition': 'error',
'no-unreachable-loop': 'error',
'no-extra-label': 'error',
'no-else-return': [
'error',
{
'allowElseIf': false
}
],
'require-atomic-updates': 'error',
'no-eval': 'error',
'no-implied-eval': 'error',
'dot-notation': 'error',
'no-array-constructor': 'error',
'max-depth': 'warn',
'max-nested-callbacks': [
'error',
3

Check warning

Code scanning / ESLint

Disallow magic numbers Warning

No magic number: 3.
],
'max-params': [
'error',
4

Check warning

Code scanning / ESLint

Disallow magic numbers Warning

No magic number: 4.
],
'indent': [
'error',
'tab'
],
'linebreak-style': [
'error',
'unix'
],
'no-template-curly-in-string': 'warn',
'quotes': [
'error',
'single'
],
'semi': [
'error',
'never'
]
}
}
84 changes: 0 additions & 84 deletions .eslintrc.json

This file was deleted.

12 changes: 12 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "None",
"checkJs": true,
"strict": true,
"noUncheckedIndexedAccess": true
},
"exclude": [
"node_modules"
]
}
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//@ts-check
'use strict'
// global/public, for debugging/testing purposes
/*exported RGBDR_anim*/
Expand All @@ -21,6 +20,7 @@ const RGBDR_anim = (() => {
/**
@param {number} n
*/
//eslint-disable-next-line no-restricted-syntax
const range = function*(n) {
for (let i = 0; i < n; i++)
yield i
Expand Down

0 comments on commit 8d970fb

Please sign in to comment.