@cabify/eslint-config 3.0.1-beta-6 → 3.0.1-beta-7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/configs/base.js CHANGED
@@ -1,28 +1,27 @@
1
- const globals = require('globals');
1
+ /* eslint-disable import/extensions */
2
+ import globals from 'globals';
2
3
 
3
- const { isPackageAvailable } = require('../utils');
4
+ import { isPackageAvailable } from '../utils.js';
5
+ import bestPractices from './best-practices.js';
6
+ import errors from './errors.js';
7
+ import es6 from './es6.js';
8
+ import formats from './formats.js';
9
+ import imports from './imports.js';
10
+ import jest from './jest.js';
11
+ import lodash from './lodash.js';
12
+ import node from './node.js';
13
+ import postcss from './postcss.js';
14
+ import promises from './promises.js';
15
+ import react from './react.js';
16
+ import reactA11y from './react-a11y.js';
17
+ import storybook from './storybook.js';
18
+ import strict from './strict.js';
19
+ import style from './style.js';
20
+ import ts from './ts.js';
21
+ import variables from './variables.js';
4
22
 
5
- const isTSAvailable = isPackageAvailable('typescript');
6
- const isJestAvailable = isPackageAvailable('jest');
7
-
8
- const storybook = require('./storybook');
9
- const ts = require('./ts');
10
- const postcss = require('./postcss');
11
-
12
- const bestPractices = require('./best-practices');
13
- const errors = require('./errors');
14
- const es6 = require('./es6');
15
- const imports = require('./imports');
16
- const node = require('./node');
17
- const promises = require('./promises');
18
- const strict = require('./strict');
19
- const style = require('./style');
20
- const variables = require('./variables');
21
- const react = require('./react');
22
- const lodash = require('./lodash');
23
- const reactA11y = require('./react-a11y');
24
- const jest = require('./jest');
25
- const formats = require('./formats');
23
+ const isTSAvailable = await isPackageAvailable('typescript');
24
+ const isJestAvailable = await isPackageAvailable('jest');
26
25
 
27
26
  const configs = [
28
27
  bestPractices,
@@ -56,7 +55,7 @@ const overrides = [
56
55
  },
57
56
  ].filter(Boolean);
58
57
 
59
- module.exports = [
58
+ export default [
60
59
  ...configs,
61
60
  {
62
61
  name: 'base-cabify-eslint-config',
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  name: 'best-practices-cabify-eslint-config',
3
3
  rules: {
4
4
  // enforces getter/setter pairs in objects
package/configs/errors.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  name: 'errors-cabify-eslint-config',
3
3
  rules: {
4
4
  // Enforce “for” loop update clause moving the counter in the right direction
package/configs/es6.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  name: 'ES6-cabify-eslint-config',
3
3
  // languageOptions: {
4
4
  // globals: {
@@ -1,6 +1,6 @@
1
- const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
1
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
2
2
 
3
- module.exports = {
3
+ export default {
4
4
  name: 'formats-cabify-eslint-config',
5
5
  ...eslintPluginPrettierRecommended,
6
6
  };
@@ -1,7 +1,7 @@
1
- const importPlugin = require('eslint-plugin-import');
2
- const simpleImportSort = require('eslint-plugin-simple-import-sort');
1
+ import importPlugin from 'eslint-plugin-import';
2
+ import simpleImportSort from 'eslint-plugin-simple-import-sort';
3
3
 
4
- module.exports = {
4
+ export default {
5
5
  name: 'imports-cabify-eslint-config',
6
6
  // languageOptions: {
7
7
  // globals: {
package/configs/jest.js CHANGED
@@ -1,6 +1,6 @@
1
- const jest = require('eslint-plugin-jest');
1
+ import jest from 'eslint-plugin-jest';
2
2
 
3
- module.exports = {
3
+ export default {
4
4
  name: 'jest-cabify-eslint-config',
5
5
  ...jest.configs['flat/recommended'],
6
6
  rules: {
package/configs/lodash.js CHANGED
@@ -1,6 +1,6 @@
1
- const lodashPlugin = require('eslint-plugin-lodash');
1
+ import lodashPlugin from 'eslint-plugin-lodash';
2
2
 
3
- module.exports = {
3
+ export default {
4
4
  name: 'lodash-cabify-eslint-config',
5
5
  plugins: { lodash: lodashPlugin },
6
6
  rules: {
package/configs/node.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  name: 'node-cabify-eslint-config',
3
3
  rules: {
4
4
  // enforce return after a callback
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  name: 'post-css-cabify-eslint-config',
3
3
  rules: {
4
4
  'global-require': 'off',
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  name: 'promises-cabify-eslint-config',
3
3
  rules: {
4
4
  'no-floating-promises': 'off',
@@ -1,6 +1,6 @@
1
- const jsxAllyPlugin = require('eslint-plugin-jsx-a11y');
1
+ import jsxAllyPlugin from 'eslint-plugin-jsx-a11y';
2
2
 
3
- module.exports = {
3
+ export default {
4
4
  name: 'react-a11y-cabify-eslint-config',
5
5
  plugins: { 'jsx-a11y': jsxAllyPlugin },
6
6
 
package/configs/react.js CHANGED
@@ -1,7 +1,7 @@
1
- const react = require('eslint-plugin-react');
2
- const reactHooks = require('eslint-plugin-react-hooks');
1
+ import react from 'eslint-plugin-react';
2
+ import reactHooks from 'eslint-plugin-react-hooks';
3
3
 
4
- module.exports = {
4
+ export default {
5
5
  name: 'react-cabify-eslint-config',
6
6
  plugins: {
7
7
  react,
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  name: 'storybook-cabify-eslint-config',
3
3
  rules: {
4
4
  'import/no-default-export': 'off',
package/configs/strict.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  name: 'strict-cabify-eslint-config',
3
3
  rules: {
4
4
  // babel inserts `'use strict';` for us
package/configs/style.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  name: 'style-cabify-eslint-config',
3
3
  rules: {
4
4
  // require camel case names
package/configs/ts.js CHANGED
@@ -1,10 +1,9 @@
1
- module.exports = {
1
+ // eslint-disable-next-line import/no-unresolved
2
+ import tseslint from 'typescript-eslint';
3
+
4
+ export default {
2
5
  name: 'ts-cabify-eslint-config',
3
- plugins: ['@typescript-eslint'],
4
- extends: [
5
- 'plugin:@typescript-eslint/recommended',
6
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
7
- ],
6
+ ...tseslint.configs.recommended,
8
7
  rules: {
9
8
  '@typescript-eslint/restrict-template-expressions': [
10
9
  'error',
@@ -1,6 +1,6 @@
1
- const confusingBrowserGlobals = require('confusing-browser-globals');
1
+ import confusingBrowserGlobals from 'confusing-browser-globals';
2
2
 
3
- module.exports = {
3
+ export default {
4
4
  name: 'variables-cabify-eslint-config',
5
5
  rules: {
6
6
  // enforce or disallow variable initializations at definition
package/eslint.config.js CHANGED
@@ -1,3 +1,4 @@
1
- const recommended = require('./recommended');
1
+ // eslint-disable-next-line import/extensions
2
+ import recommended from './recommended.js';
2
3
 
3
- module.exports = [...recommended];
4
+ export default [...recommended];
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@cabify/eslint-config",
3
- "version": "3.0.1-beta-6",
3
+ "version": "3.0.1-beta-7",
4
4
  "description": "ESLint config for Cabify Javascript projects",
5
+ "type": "module",
5
6
  "scripts": {
6
7
  "build": "echo 'No build to perform'",
7
8
  "test": "npm run lint:check && npm run format:check",
@@ -50,15 +51,19 @@
50
51
  "eslint-plugin-react": "^7.36.0",
51
52
  "eslint-plugin-react-hooks": "^4.6.2",
52
53
  "eslint-plugin-simple-import-sort": "^12.1.1",
53
- "globals": "^15.9.0"
54
+ "globals": "^15.9.0",
55
+ "typescript-eslint": "^8.8.0"
54
56
  },
55
57
  "peerDependencies": {
56
58
  "eslint": "9.11.0",
57
59
  "prettier": ">= 2.2.1"
58
60
  },
59
61
  "devDependencies": {
60
- "eslint": "9.11.0",
61
- "prettier": "3.3.3"
62
+ "@eslint/js": "^9.11.1",
63
+ "@types/eslint__js": "^8.42.3",
64
+ "eslint": "^9.11.1",
65
+ "prettier": "3.3.3",
66
+ "typescript": "^5.6.2"
62
67
  },
63
68
  "publishConfig": {
64
69
  "access": "public"
package/recommended.js CHANGED
@@ -1,4 +1,6 @@
1
- const base = require('./configs/base');
2
- const eslintConfigPrettier = require('eslint-config-prettier');
1
+ import eslintConfigPrettier from 'eslint-config-prettier';
3
2
 
4
- module.exports = [...base, eslintConfigPrettier];
3
+ // eslint-disable-next-line import/extensions
4
+ import base from './configs/base.js';
5
+
6
+ export default [...base, eslintConfigPrettier];
package/utils.js CHANGED
@@ -1,11 +1,11 @@
1
- module.exports = {
2
- isPackageAvailable(packageName) {
3
- try {
4
- // eslint-disable-next-line global-require, import/no-dynamic-require
5
- return !!require(packageName);
6
- // eslint-disable-next-line no-unused-vars
7
- } catch (e) {
8
- return false;
9
- }
10
- },
11
- };
1
+ /* eslint-disable no-unused-vars */
2
+ // eslint-disable-next-line import/prefer-default-export
3
+ export async function isPackageAvailable(packageName) {
4
+ try {
5
+ // Dynamically import the package
6
+ await import(packageName);
7
+ return true;
8
+ } catch (_) {
9
+ return false;
10
+ }
11
+ }