Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10.28.0
- uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'pnpm'
- run: pnpm install --no-frozen-lockfile
- run: pnpm -r --sort --workspace-concurrency=1 run build
- run: pnpm run lint
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"clean:packages": "pnpm -r --filter './packages/*' run clean",
"build": "pnpm -r --filter './packages/*' run build",
"test": "pnpm -r --filter './packages/*' run test",
"lint": "pnpm -r --filter './packages/*' run lint",
"prepack": "pnpm -r --filter './packages/*' run prepack",
"bootstrap": "pnpm install",
"clean:modules": "rm -rf node_modules packages/**/node_modules",
Expand All @@ -27,4 +28,4 @@
"workspaces": [
"packages/*"
]
}
}
49 changes: 26 additions & 23 deletions packages/contentstack-apps-cli/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
import tseslint from 'typescript-eslint';
import globals from 'globals';
import unicorn from 'eslint-plugin-unicorn';
import n from 'eslint-plugin-n';

export default [
...tseslint.configs.recommended,
{
ignores: [
'lib/**/*',
'test/**/*',
'dist/**/*',
],
ignores: ['lib/**/*', 'test/**/*', 'types/**/*', 'node_modules/**/*', '*.js'],
},
{
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: './tsconfig.json',
sourceType: 'module',
},
sourceType: 'module',
globals: {
...globals.node,
},
},
// unicorn/node registered (not enabled) so pre-existing inline eslint-disable
// directives that reference their rules resolve under ESLint 10 flat config.
plugins: {
'@typescript-eslint': tseslint.plugin,
unicorn,
node: n,
},
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'none',
},
],
'@typescript-eslint/prefer-namespace-keyword': 'error',
quotes: 'off',
semi: 'off',
// Pre-existing lint debt surfaced once the ESLint-10 flat-config crash was
// fixed. Kept visible as warnings (tracked for follow-up cleanup) rather
// than blocking, since these rules were never enforced while lint crashed.
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none', ignoreRestSiblings: true }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-expressions': ['warn', { allowShortCircuit: true, allowTernary: true }],
'@typescript-eslint/no-require-imports': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-wrapper-object-types': 'warn',
'@typescript-eslint/no-unsafe-function-type': 'warn',
'@typescript-eslint/no-empty-object-type': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-redeclare': 'off',
eqeqeq: ['error', 'smart'],
'id-match': 'error',
'prefer-const': 'warn',
'prefer-rest-params': 'warn',
'no-var': 'warn',
eqeqeq: 'warn',
'no-eval': 'error',
'no-var': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-require-imports': 'off',
'prefer-const': 'error',
},
},
];
];
3 changes: 1 addition & 2 deletions packages/contentstack-apps-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@
},
"scripts": {
"build": "pnpm clean && tsc -b",
"lint": "eslint . --ext .ts",
"lint": "eslint \"src/**/*.ts\"",
"postpack": "shx rm -f oclif.manifest.json",
"posttest": "pnpm lint",
"prepack": "pnpm build && oclif manifest && oclif readme",
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
"version": "oclif readme && git add README.md",
Expand Down
54 changes: 46 additions & 8 deletions packages/contentstack-audit/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,50 @@
import oclif from 'eslint-config-oclif';
import oclifTypescript from 'eslint-config-oclif-typescript';
import tseslint from 'typescript-eslint';
import globals from 'globals';
import unicorn from 'eslint-plugin-unicorn';
import n from 'eslint-plugin-n';

export default [
oclif,
oclifTypescript,
...tseslint.configs.recommended,
{
ignores: [
'dist/**/*',
],
ignores: ['lib/**/*', 'test/**/*', 'types/**/*', 'node_modules/**/*', '*.js'],
},
];
{
languageOptions: {
parser: tseslint.parser,
parserOptions: {
sourceType: 'module',
},
globals: {
...globals.node,
},
},
// unicorn/node registered (not enabled) so pre-existing inline eslint-disable
// directives that reference their rules resolve under ESLint 10 flat config.
plugins: {
'@typescript-eslint': tseslint.plugin,
unicorn,
node: n,
},
rules: {
// Pre-existing lint debt surfaced once the ESLint-10 flat-config crash was
// fixed. Kept visible as warnings (tracked for follow-up cleanup) rather
// than blocking, since these rules were never enforced while lint crashed.
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none', ignoreRestSiblings: true }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-expressions': ['warn', { allowShortCircuit: true, allowTernary: true }],
'@typescript-eslint/no-require-imports': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-wrapper-object-types': 'warn',
'@typescript-eslint/no-unsafe-function-type': 'warn',
'@typescript-eslint/no-empty-object-type': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-redeclare': 'off',
'prefer-const': 'warn',
'prefer-rest-params': 'warn',
'no-var': 'warn',
eqeqeq: 'warn',
'no-eval': 'error',
},
},
];
3 changes: 1 addition & 2 deletions packages/contentstack-audit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@
},
"scripts": {
"build": "pnpm compile && oclif manifest && oclif readme",
"lint": "eslint . --ext .ts",
"lint": "eslint \"src/**/*.ts\"",
"postpack": "shx rm -f oclif.manifest.json",
"posttest": "npm run lint",
"compile": "tsc -b tsconfig.json",
"prepack": "pnpm compile && oclif manifest && oclif readme",
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
Expand Down
65 changes: 31 additions & 34 deletions packages/contentstack-bootstrap/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,50 @@
import tseslint from 'typescript-eslint';
import globals from 'globals';
import mocha from 'eslint-plugin-mocha';
import unicorn from 'eslint-plugin-unicorn';
import n from 'eslint-plugin-n';

export default [
...tseslint.configs.recommended,

{
ignores: ['lib/**/*', 'test/**/*', 'types/**/*', 'node_modules/**/*', '*.js'],
},
{
languageOptions: {
parser: tseslint.parser,
parserOptions: {
sourceType: 'module',
},
globals: {
...globals.node,
...globals.mocha,
},
},

// unicorn/node registered (not enabled) so pre-existing inline eslint-disable
// directives that reference their rules resolve under ESLint 10 flat config.
plugins: {
'@typescript-eslint': tseslint.plugin,
mocha: mocha,
unicorn,
node: n,
},

rules: {
'unicorn/no-abusive-eslint-disable': 'off',
// Pre-existing lint debt surfaced once the ESLint-10 flat-config crash was
// fixed. Kept visible as warnings (tracked for follow-up cleanup) rather
// than blocking, since these rules were never enforced while lint crashed.
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none', ignoreRestSiblings: true }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-expressions': ['warn', { allowShortCircuit: true, allowTernary: true }],
'@typescript-eslint/no-require-imports': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-wrapper-object-types': 'warn',
'@typescript-eslint/no-unsafe-function-type': 'warn',
'@typescript-eslint/no-empty-object-type': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
indent: 'off',
'object-curly-spacing': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
},
],
'mocha/no-async-describe': 'off',
'mocha/no-identical-title': 'off',
'mocha/no-mocha-arrows': 'off',
'mocha/no-setup-in-describe': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'prefer-const': 'error',
'no-fallthrough': 'error',
'no-prototype-builtins': 'off',
},
},

{
files: ['*.d.ts'],

rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-redeclare': 'off',
'prefer-const': 'warn',
'prefer-rest-params': 'warn',
'no-var': 'warn',
eqeqeq: 'warn',
'no-eval': 'error',
},
},
];
];
3 changes: 2 additions & 1 deletion packages/contentstack-bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"version": "oclif readme && git add README.md",
"test": "npm run build && npm run test:e2e",
"test:e2e": "nyc mocha \"test/**/*.test.js\" || exit 0",
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\""
"test:report": "nyc --reporter=lcov mocha \"test/**/*.test.js\"",
"lint": "eslint \"src/**/*.ts\""
},
"dependencies": {
"@contentstack/cli-cm-seed": "~1.15.7",
Expand Down
74 changes: 26 additions & 48 deletions packages/contentstack-branches/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,72 +1,50 @@
import tseslint from 'typescript-eslint';
import globals from 'globals';
import oclif from 'eslint-config-oclif-typescript';
import unicorn from 'eslint-plugin-unicorn';
import n from 'eslint-plugin-n';

export default [
...tseslint.configs.recommended,

oclif,

{
ignores: [
'lib/**/*',
'test/**/*',
'types/**/*',
],
ignores: ['lib/**/*', 'test/**/*', 'types/**/*', 'node_modules/**/*', '*.js'],
},

{
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: './tsconfig.json',
sourceType: 'module',
},
sourceType: 'module',
globals: {
...globals.node,
},
},

// unicorn/node registered (not enabled) so pre-existing inline eslint-disable
// directives that reference their rules resolve under ESLint 10 flat config.
plugins: {
'@typescript-eslint': tseslint.plugin,
unicorn,
node: n,
},

rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{
args: 'none',
},
],
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/quotes': [
'error',
'single',
{
avoidEscape: true,
allowTemplateLiterals: true,
},
],
semi: 'off',
'@typescript-eslint/type-annotation-spacing': 'error',
// Pre-existing lint debt surfaced once the ESLint-10 flat-config crash was
// fixed. Kept visible as warnings (tracked for follow-up cleanup) rather
// than blocking, since these rules were never enforced while lint crashed.
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none', ignoreRestSiblings: true }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-expressions': ['warn', { allowShortCircuit: true, allowTernary: true }],
'@typescript-eslint/no-require-imports': 'warn',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/no-wrapper-object-types': 'warn',
'@typescript-eslint/no-unsafe-function-type': 'warn',
'@typescript-eslint/no-empty-object-type': 'warn',
'@typescript-eslint/no-this-alias': 'warn',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-redeclare': 'off',
eqeqeq: ['error', 'smart'],
'id-match': 'error',
'prefer-const': 'warn',
'prefer-rest-params': 'warn',
'no-var': 'warn',
eqeqeq: 'warn',
'no-eval': 'error',
'no-var': 'error',
quotes: 'off',
indent: 'off',
camelcase: 'off',
'comma-dangle': 'off',
'arrow-parens': 'off',
'operator-linebreak': 'off',
'object-curly-spacing': 'off',
'node/no-missing-import': 'off',
'padding-line-between-statements': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'unicorn/no-abusive-eslint-disable': 'off',
'unicorn/consistent-function-scoping': 'off',
'@typescript-eslint/no-use-before-define': 'off',
},
},
];
];
Loading
Loading