Skip to content

Commit

Permalink
Add SonarJS plugin (#132)
Browse files Browse the repository at this point in the history
* Misc fixes

* Add SonarJS, upgrade lockfile

* Add Sonar JS rules

* Update README.md
  • Loading branch information
haydenbleasel authored May 27, 2024
1 parent 0286569 commit d2e2497
Show file tree
Hide file tree
Showing 7 changed files with 3,885 additions and 2,796 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Ultracite is a robust linting preset for modern TypeScript apps. It's comprised

### ESLint

Ultracite uses [ESLint](https://eslint.org/) to enforce code quality and type safety. It includes a wide range of rules to ensure your code is consistent and error-free. Ultracite combines with pre-defined rulesets for ESLint, as well as the following plugins: [Import](https://www.npmjs.com/package/eslint-plugin-import), [jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y), [React](https://www.npmjs.com/package/eslint-plugin-react), [React Hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks), [jest](https://www.npmjs.com/package/eslint-plugin-jest), [promise](https://www.npmjs.com/package/eslint-plugin-promise), [n](https://www.npmjs.com/package/eslint-plugin-n), [Typescript](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin), [Prettier](https://www.npmjs.com/package/eslint-plugin-prettier), [Next.js](https://nextjs.org/docs/basic-features/eslint#eslint-plugin) and [Cypress](https://www.npmjs.com/package/eslint-plugin-cypress).
Ultracite uses [ESLint](https://eslint.org/) to enforce code quality and type safety. It includes a wide range of rules to ensure your code is consistent and error-free. Ultracite combines with pre-defined rulesets for ESLint, as well as the following plugins: [Import](https://www.npmjs.com/package/eslint-plugin-import), [jsx-a11y](https://www.npmjs.com/package/eslint-plugin-jsx-a11y), [React](https://www.npmjs.com/package/eslint-plugin-react), [React Hooks](https://www.npmjs.com/package/eslint-plugin-react-hooks), [jest](https://www.npmjs.com/package/eslint-plugin-jest), [promise](https://www.npmjs.com/package/eslint-plugin-promise), [n](https://www.npmjs.com/package/eslint-plugin-n), [Typescript](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin), [Prettier](https://www.npmjs.com/package/eslint-plugin-prettier), [Next.js](https://nextjs.org/docs/basic-features/eslint#eslint-plugin), [Cypress](https://www.npmjs.com/package/eslint-plugin-cypress) and [SonarJS](https://www.npmjs.com/package/eslint-plugin-sonarjs).

### Prettier

Expand Down
6 changes: 5 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable n/no-extraneous-import, import/no-extraneous-dependencies, id-length */
/* eslint-disable n/no-unpublished-import, n/no-extraneous-import, import/no-extraneous-dependencies, id-length */

import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
Expand All @@ -19,6 +19,7 @@ import * as importTypescriptResolver from 'eslint-import-resolver-typescript';

import eslintPrettier from 'eslint-config-prettier';
import * as typescriptParser from '@typescript-eslint/parser';
import sonarjs from 'eslint-plugin-sonarjs';

import eslintRules from './rules/eslint.mjs';
import reactRules from './rules/react.mjs';
Expand All @@ -36,6 +37,7 @@ import cypressRules from './rules/cypress.mjs';
import storybookRules from './rules/storybook.mjs';
// import tailwindcssRules from './rules/tailwindcss.mjs';
import unusedImportsRules from './rules/unused-imports.mjs';
import sonarjsRules from './rules/sonarjs.mjs';

// Patch AudioWorkletGlobalScope
const browserGlobals = { ...globals.browser };
Expand Down Expand Up @@ -78,6 +80,7 @@ const config = [
'@next/next': next,
'unused-imports': unusedImports,
// tailwindcss,
sonarjs,
},
rules: {
...eslintRules,
Expand All @@ -92,6 +95,7 @@ const config = [
...eslintPrettier.rules,
...unusedImportsRules,
// ...tailwindcssRules,
...sonarjsRules,
},

settings: {
Expand Down
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-sonarjs": "^1.0.3",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-tailwindcss": "^3.13.0",
"eslint-plugin-unused-imports": "^3.0.0",
Expand Down Expand Up @@ -76,10 +77,6 @@
"url": "https://github.com/haydenbleasel/ultracite/issues"
},
"homepage": "https://github.com/haydenbleasel/ultracite#readme",
"prettier": "./prettier.js",
"stylelint": {
"extends": "./stylelint.js"
},
"auto": {
"plugins": [
"npm",
Expand Down
Loading

0 comments on commit d2e2497

Please sign in to comment.