Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#cnsqa-1683 dependencies update #592

Merged
merged 17 commits into from
Jan 24, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/pages-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: npm

- name: Install dependencies
Expand Down
3 changes: 0 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry = "https://registry.npmjs.org/"
12 changes: 9 additions & 3 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ module.exports = {
'**/build/**',
'**/docs/**',
'**/.docusaurus/**',
'**/coverage/**', '**/*.js',
'**/coverage/**',
'**/*.js',
'**/*.ts',
'**/*.jsx',
'**/*.tsx',
'**/*.json'
'**/*.json',
],
extends: ['stylelint-config-standard', 'stylelint-config-css-modules'],
plugins: [
'stylelint-declaration-block-no-ignored-properties',
'stylelint-order',
'stylelint-prettier'
'stylelint-prettier',
],
rules: {
'prettier/prettier': [
Expand All @@ -30,6 +31,11 @@ module.exports = {
'no-duplicate-selectors': null,
'no-descending-specificity': null,
'declaration-no-important': [true, { severity: 'warning' }],
'declaration-property-value-no-unknown': null,
'declaration-block-no-duplicate-properties': [
true,
{ ignore: 'consecutive-duplicates' },
],
'keyframe-declaration-no-important': [true, { severity: 'warning' }],
'selector-max-id': 2,
'import-notation': null,
Expand Down
247 changes: 247 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
const babelParser = require('@babel/eslint-parser');
const js = require('@eslint/js');
const importPlugin = require('eslint-plugin-import');
const jest = require('eslint-plugin-jest');
const eslintPluginPrettierRecommended = require('eslint-plugin-prettier/recommended');
const reactPlugin = require('eslint-plugin-react');
const globals = require('globals');
const typescriptEslint = require('typescript-eslint');

module.exports = typescriptEslint.config(
{
ignores: [
'**/node_modules/**',
'**/dist/**',
'**/build/**',
'**/docs/**',
'**/.docusaurus/**',
'**/coverage/**',
'packages/create-ima-app/**/.eslintrc.js',
'packages/create-ima-app/examples/todos/assets/**',
],
},
js.configs.recommended,
reactPlugin.configs.flat.recommended,
reactPlugin.configs.flat['jsx-runtime'],
jest.configs['flat/recommended'],
jest.configs['flat/style'],
eslintPluginPrettierRecommended,
importPlugin.flatConfigs.recommended,
{
rules: {
'no-console': [
'error',
{
allow: ['warn', 'error'],
},
],
'no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: true,
caughtErrors: 'none',
},
],

// Prettier
'prettier/prettier': [
'error',
{
singleQuote: true,
semi: true,
trailingComma: 'es5',
jsxSingleQuote: true,
bracketSameLine: false,
arrowParens: 'avoid',
},
],

// Jest plugin overrides
'jest/no-mocks-import': 'off',
'jest/valid-title': 'off',
'jest/no-done-callback': 'warn',
'jest/no-disabled-tests': 'warn',
'jest/no-conditional-expect': 'warn',
'jest/prefer-expect-resolves': 'warn',
'jest/prefer-lowercase-title': [
'warn',
{
ignore: ['describe'],
},
],

// React plugin overrides
'react/prop-types': 'off',
'react/no-deprecated': 'off',

// Import plugin
'import/no-unresolved': [
'warn',
{
ignore: [
'^@\\/', // ignore @/* aliases
'@(docusaurus|theme)',
],
},
],
'import/order': [
'error',
{
groups: ['builtin', 'external', 'internal'],
pathGroups: [
{
pattern: '{preact|react|svelte|docusaurus|theme}{/**,**}',
group: 'external',
position: 'before',
},
{
pattern: '@/**',
group: 'internal',
position: 'after',
},
{
pattern: '*.{css,less,json,html,txt,csv,png,jpg,svg}',
group: 'object',
patternOptions: { matchBase: true },
position: 'after',
},
],
'newlines-between': 'always',
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.mjs', '.json'],
},
typescript: {
project: './packages/*/tsconfig.json',
},
},
},
languageOptions: {
parser: babelParser,
parserOptions: {
sourceType: 'module',
requireConfigFile: false,
babelOptions: {
presets: ['@babel/preset-react'],
},
},
globals: {
...globals.browser,
...globals.node,
...globals.es2022,
$Debug: true,
$IMA: true,
},
},
},
// Typescript support
{
files: ['**/*.{ts,tsx}'],
extends: [...typescriptEslint.configs.recommended],
languageOptions: {
...typescriptEslint.configs.recommended.languageOptions,
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.json', './packages/*/tsconfig.json'],
},
},
rules: {
'import/named': 'off', // @FIXME: Doesn't work properly when importing types - https://github.com/import-js/eslint-plugin-import/issues/3048
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{ 'ts-expect-error': false },
],
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: true,
args: 'none',
caughtErrors: 'none',
},
],
'@typescript-eslint/no-namespace': ['error', { allowDeclarations: true }],
'@typescript-eslint/no-empty-object-type': [
'error',
{ allowObjectTypes: 'always', allowInterfaces: 'always' },
],
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-require-imports': 'off',
},
},
// Type-checkd Typescript support
// TODO gradually enable everywhere
{
files: ['packages/react-page-renderer/**/!(__tests__)/*.{ts,tsx}'],
extends: [...typescriptEslint.configs.recommendedTypeChecked],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
},
},
{
files: ['packages/devtools/**'],
rules: {
// Don't work properly with aliases
'import/named': 'off',
'import/namespace': 'off',
},
},
// Website/docs overrides
{
files: ['website/**'],
rules: {
'react/react-in-jsx-scope': 'error',
'react/jsx-uses-react': 'error',
},
},
// Other overrides
{
files: [
'website/scripts/**',
'packages/cli/**',
'packages/hmr-client/**',
'packages/plugin-cli/**',
'packages/dev-utils/**',
'packages/create-ima-app/**',
],
rules: {
'no-console': 'off',
},
},
{
files: ['packages/devtools/**', 'packages/create-ima-app/**'],
languageOptions: {
globals: {
chrome: true,
FB: true,
},
},
},
{
files: ['packages/create-ima-app/template/**'],
rules: {
// Template is generated dynamically and some imports are not resolvable at the time of linting
'import/no-unresolved': 'off',
},
}
);
Loading
Loading