Skip to content

Commit

Permalink
Merge branch 'master' into remove-decorated-eslint
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
#	package.json
  • Loading branch information
vdiez committed Nov 29, 2024
1 parent 54b5898 commit 40b9c70
Show file tree
Hide file tree
Showing 1,203 changed files with 20,417 additions and 6,501 deletions.
8 changes: 7 additions & 1 deletion .eslint-doc-generatorrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
* along with this program; if not, see https://sonarsource.com/license/ssal/
*/
const rules = require('./lib').rules;
const prettier = require('prettier');
const { prettier: prettierOpts } = require('./package.json');

/** @type {import('eslint-doc-generator').GenerateOptions} */
const config = {
urlRuleDoc(name) {
return rules[name].meta.docs.url;
},
postprocess: content => content.replace('<table>', '&lt;table&gt;'),
ignoreConfig: ['recommended-legacy'],
pathRuleDoc(name) {
return `docs/${name}.md`;
Expand All @@ -36,6 +37,11 @@ const config = {
'requiresTypeChecking',
'deprecated',
],
postprocess: content =>
prettier.format(content.replace('<table>', '&lt;table&gt;'), {
...prettierOpts,
parser: 'markdown',
}),
};

module.exports = config;
10 changes: 1 addition & 9 deletions generate-eslint-package-json.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,14 @@ const eslintPluginDependencies = [
'@babel/preset-flow',
'@babel/preset-react',
'@eslint-community/regexpp',
'@typescript-eslint/eslint-plugin',
'@typescript-eslint/utils',
'builtin-modules',
'bytes',
'eslint-plugin-import',
'eslint-plugin-jsx-a11y',
'eslint-plugin-react',
'eslint-plugin-react-hooks',
'eslint-scope',
'functional-red-black-tree',
'jsx-ast-utils',
'minimatch',
'scslre',
'semver',
'typescript',
'vue-eslint-parser',
];

const mainPackageJson = JSON.parse(
Expand Down Expand Up @@ -90,7 +82,7 @@ await fs.writeFile(
'https://github.com/SonarSource/SonarJS/blob/master/packages/jsts/src/rules/README.md',
dependencies,
peerDependencies: {
eslint: '8.0.0 - 9.14',
eslint: '^8.0.0 || ^9.0.0',
},
},
null,
Expand Down
1 change: 0 additions & 1 deletion its/eslint8-plugin-sonarjs/eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module.exports = [
plugin.configs.recommended,
{
rules: {
'sonarjs/accessor-pairs': 'error',
'sonarjs/no-implicit-dependencies': 'error',
},
},
Expand Down
1 change: 0 additions & 1 deletion its/eslint8-plugin-sonarjs/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default [
plugin.configs.recommended,
{
rules: {
'sonarjs/accessor-pairs': 'error',
'sonarjs/no-implicit-dependencies': 'error',
},
},
Expand Down
1 change: 0 additions & 1 deletion its/eslint8-plugin-sonarjs/tseslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import parser from '@typescript-eslint/parser';
console.log(`Loaded ${Object.keys(plugin.configs.recommended.rules ?? {}).length} rules`);

export default tseslint.config(plugin.configs.recommended, {
rules: { 'sonarjs/accessor-pairs': 'error' },
files: ['**/*.ts'],
languageOptions: {
parser,
Expand Down
1 change: 0 additions & 1 deletion its/eslint9-plugin-sonarjs/eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ module.exports = [
plugin.configs.recommended,
{
rules: {
'sonarjs/accessor-pairs': 'error',
'sonarjs/no-implicit-dependencies': 'error',
},
},
Expand Down
1 change: 0 additions & 1 deletion its/eslint9-plugin-sonarjs/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default [
plugin.configs.recommended,
{
rules: {
'sonarjs/accessor-pairs': 'error',
'sonarjs/no-implicit-dependencies': 'error',
},
},
Expand Down
1 change: 0 additions & 1 deletion its/eslint9-plugin-sonarjs/tseslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import parser from '@typescript-eslint/parser';
console.log(`Loaded ${Object.keys(plugin.configs.recommended.rules ?? {}).length} rules`);

export default tseslint.config(plugin.configs.recommended, {
rules: { 'sonarjs/accessor-pairs': 'error' },
files: ['**/*.ts'],
languageOptions: {
parser,
Expand Down
72 changes: 20 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"ruling-parametrized": "node tools/prepare-ruling.js && SONAR_RULING_SETTINGS=../settings.js tsx --tsconfig packages/tsconfig.test.json --test packages/ruling/tests/projects/*.ruling.test.ts",
"ruling-sync": "rsync -avh packages/ruling/tests/actual/jsts/ its/ruling/src/test/expected/jsts/ --delete",
"update-ruling-data": "mvn -f sonar-plugin/sonar-javascript-plugin/pom.xml compile && npx tsx packages/ruling/tests/tools/parseRulesData.ts",
"create-rule-indexes": "tsx tools/generate-rule-indexes.ts",
"bridge:compile": "tsc -b packages profiling && npm run _:bridge:copy-protofiles",
"bridge:test": "tsx --tsconfig packages/tsconfig.test.json --test --test-reporter spec --test-reporter-destination stdout \"packages/*/src/rules/*[!node_modules]/**/*.test.ts\" \"packages/*[!ruling]/tests/**/*.test.ts\"",
"bridge:test:cov": "odz run npm run bridge:test || true && odz report --reporters=text-lcov > lcov.info",
Expand All @@ -28,7 +29,7 @@
"plugin:build:fast": "mvn install -DskipTests && npm run update-ruling-data",
"pbf": "npm run plugin:build:fast",
"td": "npm --prefix typedoc/searchable-parameters-plugin run setup && npx typedoc --options typedoc/typedoc.js",
"prepare": "husky",
"prepare": "husky && npm run create-rule-indexes",
"precommit": "pretty-quick --staged",
"count-rules": "node tools/count-rules.js",
"_:bridge:copy-protofiles": "cpy --flat packages/jsts/src/parsers/estree.proto sonar-plugin/bridge/src/main/protobuf && cpy --flat packages/jsts/src/parsers/estree.proto lib/jsts/src/parsers",
Expand All @@ -44,7 +45,7 @@
"eslint-plugin:types": "tsc -p tsconfig-plugin.json --declaration true --emitDeclarationOnly --outDir lib/types",
"eslint-plugin:package-json": "node generate-eslint-package-json.mjs",
"eslint-plugin:copy-assets": "cpy LICENSE.txt lib/ --rename LICENSE && cpy packages/jsts/src/rules/README.md lib/ --flat",
"eslint-docs": "npm run eslint-plugin:compile && eslint-doc-generator lib --init-rule-docs"
"eslint-docs": "npm run eslint-plugin:compile && eslint-doc-generator lib --init-rule-docs && tsx tools/generate-external-rules-docs.ts"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -121,7 +122,7 @@
"htmlparser2": "9.1.0",
"jsx-ast-utils": "3.3.5",
"lodash.clone": "4.5.0",
"minimatch": "10.0.1",
"minimatch": "9.0.5",
"module-alias": "2.2.3",
"postcss": "8.4.49",
"postcss-html": "0.36.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/jsts/src/analysis/analyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { debug, info } from '../../../shared/src/helpers/logging.js';
import { SourceCode } from 'eslint';
import { JsTsAnalysisInput, JsTsAnalysisOutput } from './analysis.js';
import { TSESTree } from '@typescript-eslint/utils';
import type { TSESTree } from '@typescript-eslint/utils';
import { JsTsLanguage } from '../../../shared/src/helpers/language.js';
import { getLinter } from '../linter/linters.js';
import { buildSourceCode } from '../builders/build.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/jsts/src/linter/visitors/cpd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program; if not, see https://sonarsource.com/license/ssal/
*/
import estree from 'estree';
import { TSESTree } from '@typescript-eslint/utils';
import type { TSESTree } from '@typescript-eslint/utils';
import { SourceCode, AST } from 'eslint';
import { visit } from './visitor.js';
import { Location } from './metrics/helpers/location.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/jsts/src/linter/visitors/symbol-highlighting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
import { Rule, Scope } from 'eslint';
import estree from 'estree';
import { TSESTree } from '@typescript-eslint/utils';
import type { TSESTree } from '@typescript-eslint/utils';
import { AST } from 'vue-eslint-parser';
import { convertLocation, extractTokensAndComments, Location } from './metrics/helpers/index.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/jsts/src/parsers/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program; if not, see https://sonarsource.com/license/ssal/
*/
import protobuf from 'protobufjs';
import { TSESTree } from '@typescript-eslint/utils';
import type { TSESTree } from '@typescript-eslint/utils';
import { debug } from '../../../shared/src/helpers/logging.js';

import path from 'path';
Expand Down
2 changes: 2 additions & 0 deletions packages/jsts/src/rules/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rules.ts
plugin-rules.ts
Loading

0 comments on commit 40b9c70

Please sign in to comment.