How boldyrev-d/stylelint-config-generator works
Project type and purpose
• This is a single-page web application (SPA) bootstrapped with Create React App.
• It provides a UI for generating a stylelint configuration file based on user-selected rules.
• The tech stack is React + Redux (for state management), styled-components (for CSS-in-JS styling), and a small rules-generation engine.
File structure
Top level
• public/
– index.html (the SPA host)
– manifest.json
• src/
– index.js, registerServiceWorker.js (app entry, PWA support)
– components/ (presentational React components: App, Header, Footer, Options, Variant, BasicButton, Config)
– AC/ (“Action Creators”? or abstraction for config generation, with index.js)
– middlewares/ (Redux middleware to pre-process actions, e.g. checkDefaultRule.js)
– reducer/ (root reducer)
– store/ (Redux store configuration)
– rules.js, stylelintCSSConfig.json (engine: list of available rules)
– constants.js, style-utils.js (utility modules)
Config & tooling
• .eslintrc, .stylelintrc, stylelintCSSConfig.json
• Travis CI (.travis.yml) + now.sh deployment
• package.json (dependencies: react, redux, styled-components, etc.)
Key insights from README
• React/Redux front end
• styled-components styling
• No back-end: purely client-side generation
• Build → Travis CI → now.sh
Main components & interactions
a. Browser (Client)
– Hosts the SPA at public/index.html
– Loads bundle.js generated by Webpack
b. React App
– UI Layer (components/)
– Entry point: src/index.js → App.jsx
c. Redux Layer
– Store: src/store/index.js
– Reducers: src/reducer/index.js
– Middlewares: src/middlewares/checkDefaultRule.js
– Action creators: src/AC/index.js
d. Rules Engine
– rules.js + stylelintCSSConfig.json
– style-utils.js (helpers to format the JSON)
e. Config Downloader
– Config.jsx component triggers the download of the generated JSON
f. Build & CI/CD
– Travis CI pipeline (.travis.yml)
– now.sh deployment
Data flow (unidirectional Flux pattern):
1. User interacts with UI (Options, Variant components)
2. UI dispatches Actions via Action Creators
3. Middleware intercepts/validates (checkDefaultRule.js)
4. Reducer updates state (selected rules, options)
5. Components subscribe to store → re-render UI
6. Config component calls Rules Engine → builds stylelint JSON
7. Browser triggers file download
Architectural patterns & design principles
• Component-based UI (React)
• Unidirectional data flow (Redux)
• Separation of concerns
– UI (components/)
– State management (store/, reducer/, middlewares/)
– Business logic (rules.js + style-utils.js)
• Deployment pipeline as code (CI/CD)
Detail without over-splitting
• Logical layer.
• Data paths.
• External dependencies (styled-components, ESLint, Prettier).
• CI/CD separately so readers see build & deployment flow.