Skip to content

Commit

Permalink
add no more than 2 fields sample
Browse files Browse the repository at this point in the history
  • Loading branch information
haifeng-li-at-salesforce committed May 9, 2024
2 parents fd6a741 + 14110d2 commit 7d4ff48
Show file tree
Hide file tree
Showing 14 changed files with 220 additions and 70 deletions.
16 changes: 0 additions & 16 deletions .eslintrc

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/node_modules
/reports
/dist
test-report.xml
junit.xml


22 changes: 22 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2024, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/

import eslint from '@eslint/js';
import tsEslint from 'typescript-eslint';

export default tsEslint.config(
eslint.configs.recommended,
...tsEslint.configs.recommended,
...tsEslint.configs.stylistic,

{
rules: {
strict: ['error', 'global'],
'@typescript-eslint/no-extra-non-null-assertion': 'off'
}
}
);
5 changes: 2 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ export default {
preset: 'ts-jest',
testMatch: [
'<rootDir>/test/plugin.ts',
'<rootDir>/test/lib/rules/**/*.ts',
'!**/test/lib/rules/shared.ts'
'<rootDir>/test/rules/**/*.ts',
'!**/test/rules/shared.ts'
],
moduleFileExtensions: ['ts', 'js', 'json'],

testResultsProcessor: 'jest-sonar-reporter',
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/lib/'],
moduleDirectories: ['node_modules'],
Expand Down
208 changes: 175 additions & 33 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
"url": "https://github.com/salesforce/eslint-plugin-lwc-mobile"
},
"scripts": {
"build": "tsc",
"format": "prettier --list-different \"**/*.{ts,js}\"",
"format:fix": "prettier --write \"**/*.{ts,js,json}\"",
"lint": "eslint lib test",
"lint": "eslint src test",
"test": "jest --coverage"
},
"jestSonar": {
Expand All @@ -52,27 +53,26 @@
"node": ">=18"
},
"type": "module",
"main": "lib/index.js",
"main": "dist/src/index.js",
"directories": {
"lib": "lib",
"rules": "lib/rules",
"lib": "src",
"rules": "src/rules",
"test": "test"
},
"files": [
"/lib",
"/src",
"!**/test/"
],
"dependencies": {
"@typescript-eslint/parser": "^7.8.0",
"@typescript-eslint/utils": "^7.8.0",
"eslint-plugin-eslint-plugin": "^6.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint": "^8.57.0"
},
"devDependencies": {
"@eslint/js": "^9.2.0",
"@jest/globals": "^29.7.0",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@typescript-eslint/rule-tester": "^7.8.0",
"@typescript-eslint/utils": "^7.8.0",
"eslint": "^8.57.0",
"eslint-plugin-eslint-plugin": "^6.1.0",
"eslint-plugin-node": "^11.1.0",
"jest": "^29.7.0",
"jest-chain": "^1.1.6",
"jest-extended": "^4.0.1",
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions lib/index.ts → src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/

import base from './configs/base';
import recommended from './configs/recommended';
import enforceFooBar from './rules/enforce-foo-bar';
import base from './configs/base.js';
import recommended from './configs/recommended.js';
import enforceFooBar from './rules/enforce-foo-bar.js';
export default {
rules: {
'enforce-foo-bar': enforceFooBar
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RuleTester } from '@typescript-eslint/rule-tester';

import ruleEnforceFoorBar from '../../../lib/rules/enforce-foo-bar';
import ruleEnforceFoorBar from '../../src/rules/enforce-foo-bar';

const ruleTester = new RuleTester({
parser: '@typescript-eslint/parser'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RuleTester } from '@typescript-eslint/rule-tester';
import { rule } from '../../../lib/rules/no-more-than-2-fields';
import { rule } from '../../src/rules/no-more-than-2-fields';

const ruleTester = new RuleTester({
parser: '@graphql-eslint/eslint-plugin',
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"noUnusedParameters": true /* Raise an error when a function parameter isn't read. */,
"noImplicitReturns": true /* Enable error reporting for codepaths that do not explicitly return in a function. */,
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
},
"include": ["src/**/*"]
}

0 comments on commit 7d4ff48

Please sign in to comment.