diff --git a/.commitlintrc.js b/.commitlintrc.js new file mode 100644 index 0000000000..e625956837 --- /dev/null +++ b/.commitlintrc.js @@ -0,0 +1,25 @@ +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'header-max-length': [2, 'always', 72], + 'body-max-line-length': [2, 'always', 80], + 'scope-case': [0, 'always', 'lower-case'], + 'type-enum': [ + 2, + 'always', + [ + 'build', + 'ci', + 'chore', + 'docs', + 'feat', + 'fix', + 'perf', + 'refactor', + 'revert', + 'style', + 'test', + ], + ], + }, +}; diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000..f5c73e56ab --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,60 @@ +module.exports = { + parser: '@babel/eslint-parser', + parserOptions: { + babelOptions: { + presets: ['@babel/preset-react'], + }, + }, + plugins: ['ssr-friendly'], + ignorePatterns: ['packages/ibm-products-web-components/**/*'], + extends: ['carbon', 'plugin:ssr-friendly/recommended'], + rules: { + 'react/display-name': [0], + 'react/forbid-component-props': [ + 2, + { + forbid: [ + { + propName: 'style', + disallowedFor: ['Datagrid', 'Carousel', 'Checklist', 'Coachmark'], + message: 'Avoid using style prop', + }, + ], + }, + ], + 'react/forbid-dom-props': [ + 2, + { + forbid: [ + { + propName: 'style', + disallowedFor: ['Datagrid', 'Carousel', 'Checklist', 'Coachmark'], + message: 'Avoid using style prop', + }, + ], + }, + ], + }, + overrides: [ + { + files: ['*.ts', '*.tsx'], + plugins: ['@typescript-eslint'], + extends: ['plugin:@typescript-eslint/recommended'], + parser: '@typescript-eslint/parser', + rules: { + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + args: 'after-used', + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + }, + ], + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + }, + }, + ], +}; diff --git a/.stylelintrc.js b/.stylelintrc.js index 310f32ed37..edfe291b21 100644 --- a/.stylelintrc.js +++ b/.stylelintrc.js @@ -1,7 +1,11 @@ module.exports = { - root: true, - extends: ['stylelint-config-ibm-products'], + extends: ['stylelint-config-carbon'], rules: { - 'import-notation': 'string', + 'max-nesting-depth': null, + 'scss/no-global-function-names': null, + 'csstools/use-logical': null, + 'scss/load-no-partial-leading-underscore': null, + 'scss/double-slash-comment-inline': null, + 'no-duplicate-selectors': null, }, }; diff --git a/package.json b/package.json index 31587ffb5a..d1d49a9702 100644 --- a/package.json +++ b/package.json @@ -123,133 +123,6 @@ "ws": "^8.17.1", "@carbon/ibm-products-styles": "^2.49.0" }, - "eslintConfig": { - "parser": "@babel/eslint-parser", - "parserOptions": { - "babelOptions": { - "presets": [ - "@babel/preset-react" - ] - } - }, - "plugins": [ - "ssr-friendly" - ], - "ignorePatterns": [ - "packages/ibm-products-web-components/**/*" - ], - "extends": [ - "carbon", - "plugin:ssr-friendly/recommended" - ], - "rules": { - "react/display-name": [ - 0 - ], - "react/forbid-component-props": [ - 2, - { - "forbid": [ - { - "propName": "style", - "disallowedFor": [ - "Datagrid", - "Carousel", - "Checklist", - "Coachmark" - ], - "message": "Avoid using style prop" - } - ] - } - ], - "react/forbid-dom-props": [ - 2, - { - "forbid": [ - { - "propName": "style", - "disallowedFor": [ - "Datagrid", - "Carousel", - "Checklist", - "Coachmark" - ], - "message": "Avoid using style prop" - } - ] - } - ] - }, - "overrides": [ - { - "files": [ - "*.ts", - "*.tsx" - ], - "plugins": [ - "@typescript-eslint" - ], - "extends": [ - "plugin:@typescript-eslint/recommended" - ], - "parser": "@typescript-eslint/parser", - "rules": { - "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - "args": "after-used", - "argsIgnorePattern": "^_", - "varsIgnorePattern": "^_" - } - ], - "@typescript-eslint/no-empty-function": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/ban-ts-comment": "off" - } - } - ] - }, - "commitlint": { - "extends": [ - "@commitlint/config-conventional" - ], - "rules": { - "header-max-length": [ - 2, - "always", - 72 - ], - "body-max-line-length": [ - 2, - "always", - 80 - ], - "scope-case": [ - 0, - "always", - "lower-case" - ], - "type-enum": [ - 2, - "always", - [ - "build", - "ci", - "chore", - "docs", - "feat", - "fix", - "perf", - "refactor", - "revert", - "style", - "test" - ] - ] - } - }, "lint-staged": { "!(examples/**/*)**/*.{js,jsx,ts,tsx}": [ "npx prettier --cache --write", @@ -270,18 +143,5 @@ "dependencies": { "stylelint-plugin-carbon-tokens": "2.8.0" }, - "stylelint": { - "extends": [ - "stylelint-config-carbon" - ], - "rules": { - "max-nesting-depth": null, - "scss/no-global-function-names": null, - "csstools/use-logical": null, - "scss/load-no-partial-leading-underscore": null, - "scss/double-slash-comment-inline": null, - "no-duplicate-selectors": null - } - }, "packageManager": "yarn@4.0.2" }