From 5fa2c75a6f98afb53e366b1d62ee194bf49e81de Mon Sep 17 00:00:00 2001 From: Aetherinox Date: Sun, 21 Apr 2024 21:49:32 -0700 Subject: [PATCH] chore: modify linter --- .eslintrc | 176 +++++++++++++++++++++++++++++----------------- eslint.config.mjs | 167 ------------------------------------------- 2 files changed, 111 insertions(+), 232 deletions(-) delete mode 100644 eslint.config.mjs diff --git a/.eslintrc b/.eslintrc index 47634106..7e10dcb5 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,71 +1,117 @@ { - "plugins": ["prettier", "import", "babel"], - "extends": ["standard", "eslint:recommended", "plugin:prettier/recommended"], - "rules": { - "semi": ["off", "off"], - "one-var": "off", - "space-before-function-paren": "off", - "no-throw-literal": "off", - "camelcase": ["error", { "properties": "always" }], - "no-console": "off", - "no-alert": "error", - "no-debugger": "error", - "prefer-arrow-callback": "error", - "object-property-newline": "off", - "no-useless-escape": "off", - "no-var": "error", - "prefer-const": "error", - "no-unused-expressions": "off", - "strict": ["error", "never"], - "no-mixed-operators": "off", - "prefer-promise-reject-errors": "off", - "standard/no-callback-literal": 0, - "object-curly-spacing": "off", - "quote-props": "off", - "no-new-object": "error", - "object-shorthand": "off", - "no-array-constructor": "error", - "array-callback-return": "error", - "no-eval": "error", - "no-new-func": "error", - "prefer-rest-params": "error", - "prefer-spread": "error", - "no-useless-constructor": "error", - "no-dupe-class-members": "error", - "no-duplicate-imports": "error", - "eqeqeq": "error", - "no-unneeded-ternary": "error", - "curly": "error", - "prettier/prettier": "error", - "no-empty": "off", - "no-restricted-syntax": [ - "error", - { - "selector": "ExportDefaultDeclaration", - "message": "Prefer named exports" - } - ], - "import/no-webpack-loader-syntax": "off", - "import/no-relative-parent-imports": "error", - "import/first": "error", - "import/no-default-export": "error", - "babel/no-unused-expressions": "error", - "node/no-callback-literal": 0, - "n/no-callback-literal": 0 - }, - "parserOptions": { - "sourceType": "module", - "requireConfigFile": false, - "ecmaFeatures": { - "globalReturn": true - } - }, "parser": "@babel/eslint-parser", "globals": { - "_": true, - "$": true + "_": true, + "$": true }, "env": { - "browser": true + "browser": true, + "node": true, + "es6": true, + "jest": true, + "jquery": true + }, + "parserOptions": { + "requireConfigFile": false, + "ecmaVersion": 6, + "sourceType": "module", + "ecmaFeatures": { + "arrowFunctions": true, + "binaryLiterals": true, + "blockBindings": true, + "classes": true, + "defaultParams": true, + "destructuring": true, + "forOf": true, + "generators": true, + "modules": true, + "objectLiteralComputedProperties": true, + "objectLiteralDuplicateProperties": true, + "objectLiteralShorthandMethods": true, + "objectLiteralShorthandProperties": true, + "octalLiterals": true, + "regexUFlag": true, + "regexYFlag": true, + "spread": true, + "superInFunctions": true, + "templateStrings": true, + "unicodeCodePointEscapes": true, + "globalReturn": true, + "jsx": true, + "experimentalObjectRestSpread": true + } + }, + "plugins": [ + "prettier", + "import", + "babel" + ], + "extends": [ + "standard", + "eslint:recommended", + "plugin:prettier/recommended" + ], + "rules": { + "semi": [ + "off", + "off" + ], + "one-var": "off", + "space-before-function-paren": "off", + "no-throw-literal": "off", + "camelcase": [ + "error", + { + "properties": "always" + } + ], + "no-console": "off", + "no-alert": "error", + "no-debugger": "error", + "prefer-arrow-callback": "error", + "object-property-newline": "off", + "no-useless-escape": "off", + "no-var": "error", + "prefer-const": "error", + "no-unused-expressions": "off", + "strict": [ + "error", + "never" + ], + "no-mixed-operators": "off", + "prefer-promise-reject-errors": "off", + "standard/no-callback-literal": 0, + "object-curly-spacing": "off", + "quote-props": "off", + "no-new-object": "error", + "object-shorthand": "off", + "no-array-constructor": "error", + "array-callback-return": "error", + "no-eval": "error", + "no-new-func": "error", + "prefer-rest-params": "error", + "prefer-spread": "error", + "no-useless-constructor": "error", + "no-dupe-class-members": "error", + "no-duplicate-imports": "error", + "eqeqeq": "error", + "no-unneeded-ternary": "error", + "curly": "error", + "prettier/prettier": "error", + "no-empty": "off", + "no-restricted-syntax": [ + "error", + { + "selector": "ExportDefaultDeclaration", + "message": "Prefer named exports" + } + ], + "import/no-webpack-loader-syntax": "off", + "import/no-relative-parent-imports": "error", + "import/first": "error", + "import/no-default-export": "error", + "babel/no-unused-expressions": "error", + "node/no-callback-literal": 0, + "n/no-callback-literal": 0 } -} + } diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index 6bc38c6f..00000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,167 +0,0 @@ -/* - eslint v9 flat config - this has been migrated over from .eslintrc in favor of the new flat config structure - - this file will replace /root/.eslintrc once upgrading to ESLint v9 / grunt-eslint v25 - - @ref : https://eslint.org/blog/2022/08/new-config-system-part-2/ -*/ - -import { FlatCompat } from '@eslint/eslintrc'; -import { fileURLToPath } from 'url'; -import path from 'path'; - -/* - mimic CommonJS variables -- not needed if using CommonJS -*/ - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -const compat = new FlatCompat(); - -import pluginJs from '@eslint/js'; -import babelParser from '@babel/eslint-parser'; -import pluginPrettier from 'eslint-plugin-prettier'; -import importPlugin from 'eslint-plugin-import'; -import nodePlugin from 'eslint-plugin-n'; -// import eslintCommentsPlugin from 'eslint-plugin-eslint-comments'; -import babelPlugin from 'eslint-plugin-babel'; -import pluginPromise from 'eslint-plugin-promise' -import globals from "globals"; - -// import jsdoc from "eslint-plugin-jsdoc"; - -export default [ - ...compat.config({ - extends: [ - 'prettier', - 'plugin:prettier/recommended' - - // 'plugin:cypress/recommended', - // Not ready for ESLint 9 yet, see https://github.com/cypress-io/eslint-plugin-cypress/issues/156 - ], - rules: { - 'no-console': process.env.NODE_ENV === 'production' ? 'off' : 'off', - 'no-debugger': process.env.NODE_ENV === 'production' ? 'off' : 'off' - }, - }), - { - files: ["**/*.js", "**/*.cjs"], - ignores: [ - '**/jest.config.js', - '**/node_modules/**', - '**/dist/**', - '**/fixtures/**', - '**/coverage/**', - '**/__snapshots__/**', - '**/docs/**', - '**/build/**', - '**/.github/**' - ], - - languageOptions: { - ecmaVersion: 6, - parser: babelParser, - sourceType: "module", - parserOptions: { - requireConfigFile: false, - babelOptions: { - babelrc: false, - configFile: false, - presets: ["@babel/preset-env"], - } - } - }, - - /* - Compatibility warning: - some of these plugins are NOT compatible with ESLint 9 / grunt-eslint v25 - - for now, we've switched over to the new flat config, that way when we do upgrade, it's - seamless - */ - - plugins: { - ['@plugin-prettier']: pluginPrettier, - ['import']: importPlugin, - ['@plugin-babel']: babelPlugin, - ['n']: nodePlugin - }, - - - rules: { - - /* - Plugin > Import - */ - 'import/no-webpack-loader-syntax': 'off', - 'import/no-relative-parent-imports': 'error', - 'import/first': 'error', - 'import/no-commonjs': 'off', - 'import/no-default-export': 'error', - 'n/no-deprecated-api': 'error', - 'import/no-commonjs': 'error', - - /* - Plugin > babel - */ - - '@plugin-babel/no-unused-expressions': 'error', - - /* - Plugin > Prettier - */ - - '@plugin-prettier/prettier': 'error', - - - 'semi': ['off', 'off'], - 'one-var': 'off', - 'space-before-function-paren': 'off', - 'no-throw-literal': 'off', - 'camelcase': ['error', { 'properties': 'always' }], - 'no-console': 'off', - 'no-alert': 'error', - 'no-debugger': 'error', - 'prefer-arrow-callback': 'error', - 'object-property-newline': 'off', - 'no-useless-escape': 'off', - 'no-var': 'error', - 'prefer-const': 'error', - 'no-unused-expressions': 'off', - 'strict': ['error', 'never'], - 'no-mixed-operators': 'off', - 'prefer-promise-reject-errors': 'off', - 'standard/no-callback-literal': 'off', - 'object-curly-spacing': 'off', - 'quote-props': 'off', - 'no-new-object': 'error', - 'object-shorthand': 'off', - 'no-array-constructor': 'error', - 'array-callback-return': 'error', - 'no-eval': 'error', - 'no-new-func': 'error', - 'prefer-rest-params': 'error', - 'prefer-spread': 'error', - 'no-useless-constructor': 'error', - 'no-dupe-class-members': 'error', - 'no-duplicate-imports': 'error', - 'eqeqeq': 'error', - 'no-unneeded-ternary': 'error', - 'curly': 'error', - 'no-empty': 'off', - 'no-restricted-syntax': [ - 'error', - { - 'selector': 'ExportDefaultDeclaration', - 'message': 'Prefer named exports' - } - ], - 'node/no-callback-literal': 'off', - 'n/no-callback-literal': 'off' - } - },{ - languageOptions: { globals: globals.browser } - } -];