Skip to content

chore: fix and update prettier and linter rules#9

Open
kumar111222rohit wants to merge 1 commit intosanishkr:masterfrom
kumar111222rohit:chore-formatting-and-linter
Open

chore: fix and update prettier and linter rules#9
kumar111222rohit wants to merge 1 commit intosanishkr:masterfrom
kumar111222rohit:chore-formatting-and-linter

Conversation

@kumar111222rohit
Copy link

@kumar111222rohit kumar111222rohit commented Aug 31, 2025

 ## Summary
 Modernized the linting and formatting setup for better code quality and consistency.
 
 ## Changes
 - ✅ Updated ESLint configuration to use modern standards
 - ✅ Enhanced Prettier configuration with comprehensive formatting rules
 - ✅ Added React Hooks linting rules
 - ✅ Fixed 200+ formatting issues across the codebase
 - ✅ Added proper ignore patterns for build files
 - ✅ Configured Flow support for existing type annotations
 
 ## Benefits
 - Consistent code formatting across the project
 - Better code quality enforcement
 - Modern React best practices
 - Improved developer experience
 
 ## Testing
 - All linting passes with 0 errors
 - Prettier formatting applied consistently
 - No breaking changes to existing functionality

"prepublish": "npm run pretty && npm run test && npm run build",
"demo": "webpack-dev-server --inline --hot --config demo/webpack.config.js --content-base demo/",
"pretty": "prettier --write '{__tests__,src}/*.js'"
"format": "prettier --write \"{src,__tests__,demo,*.js,*.json,*.md}\"",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still exists in L:15, unpublish

"build": "babel src/index.js --out-file dist.js",
"umd": "webpack --config webpack.config.umd.js",
"lint": "eslint {__tests__,src}/*.js",
"lint": "eslint .",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

running npm i with --legacy-peer-deps flag returns error like this:

Image

Please make sure to validate changes locally before creating PR

Comment on lines +4 to +27
quoteProps: 'as-needed',
trailingComma: 'none',
tabWidth: 2,
useTabs: false,
printWidth: 80,
endOfLine: 'lf',
bracketSpacing: true,
arrowParens: 'avoid',
jsxSingleQuote: true,
overrides: [
{
files: '*.json',
options: {
printWidth: 200
}
},
{
files: '*.md',
options: {
proseWrap: 'always',
printWidth: 72
}
}
]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why we need all of these rules, pls mention the need and what it does?

import { createRoot } from 'react-dom/client';
import ProgressiveImage from '../src/index.js';
import React from 'react'
import {createRoot} from 'react-dom/client'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would keep the rule to keep spaces in named imports

};
const { image, loading, srcSetData } = this.state;
const { src, children, noRetry, noLazyLoad } = this.props;
const { src, children, noLazyLoad } = this.props;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was supposed to be intended feature, check documentation.
Better fix its usage than remove it

Comment on lines +33 to +39
'error',
{argsIgnorePattern: '^_', ignoreRestSiblings: true}
],
'no-console': 'warn',
'prefer-const': 'error',
'no-var': 'error'
},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here: if all of it is needed.
If yes, pls add explaination

Comment on lines +2 to +6
umd/
node_modules/
coverage/
*.min.js
demo/bundle.js No newline at end of file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some of these may not exist in project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants